sql

select  * from ActivityCourse where 1=1 and '16/11/2012' between startDate and endDate or '17/11/2012' between startDate and endDate or ( startDate< '16/11/2012' and '17/11/2012' endDate )
这句sql语法有什么错?

解决方案 »

  1.   

    select  * 
    from ActivityCourse 
    where 1=1 
    and '16/11/2012' between startDate and endDate 
    or '17/11/2012' between startDate and endDate 
    or ( startDate< '16/11/2012' and '17/11/2012'>endDate )
      

  2.   

    select  * from ActivityCourse where 1=1 and '11/11/2012' between startDate and endDate or '16/11/2012' between startDate and endDate or ( startDate < '11/11/2012' and '16/11/2012' >endDate )
    还是不行
      

  3.   

    select  * from ActivityCourse where 1=1 and '16/11/2012' between startDate and endDate or '17/11/2012' between startDate and endDate or ( startDate< '16/11/2012' and '17/11/2012' endDate )
    这里少了大于或者小于
      

  4.   

    Syntax error (missing operator) in query expression '1=1 and '16/11/2012' between startDate and endDate or '21/11/2012' between startDate and endDate or '( startDate < '16/11/2012' and '21/11/2012' >endDate )'.
      

  5.   

    SELECT  *
    FROM    ActivityCourse
    WHERE   1 = 1
            AND ( '11/11/2012' BETWEEN startDate AND endDate )
            OR ( '16/11/2012' BETWEEN startDate AND endDate )
            OR ( startDate < '11/11/2012'
                 AND '16/11/2012' > endDate
               )
      

  6.   


     '1=1 
    and '16/11/2012' between startDate and endDate 
    or '21/11/2012' between startDate and endDate 
    or '( startDate < '16/11/2012' and '21/11/2012' >endDate )'.lz检查一下红色的引号是代码里面带的不》?
    应该是没有就对了。 
      

  7.   

    between a and b 需要加括号
      

  8.   


    SELECT *
    FROM   ActivityCourse
    WHERE  1 = 1
           AND '16/11/2012' BETWEEN startDate AND endDate
            OR '17/11/2012' BETWEEN startDate AND endDate
            OR ( startDate < '16/11/2012'
                 AND '17/11/2012' > endDate ) 少了 一个>符号