sql语句里是一个等号    =='2003'"
sql里有没有substr这个函数  好像是一个问题

解决方案 »

  1.   

    你可以这样做:
    把你的date个转换为date类型即2003-04-05
    然后这样query="select aaa,bbb from table
                   where month(date)='2003'"
            mydb=query($query)
      

  2.   

    month()
    是数据库的函数,特别好用。
      

  3.   

    呵呵!你用时间戳破函数计算出年份呀呀!
    这样:
    query="select aaa,bbb from table where strftime('%Y',date)=='2003'"
    mydb=query($query)
      

  4.   

    query="select aaa,bbb from table where date LIKE '2003%'";
      

  5.   

    1.
    query="select aaa,bbb from table where substr(date,0,4)=='2003'"
    SQL里没有substr()函数,没有==运算符;
    支持楼上的写法;
    2.
    mydb=query($query)
         *****
    PHP里好象没有query()这个函数?