我写的语句如下,但数据库总提示“month是无效的标示符”,请问应该怎么改?select s.SUPPLIER_NAME,s.BOOK_NAME,s.isbn,substr(to_char(d.user_time,'yyyy-mm-dd'),6,2) as month, count(d.user_time) as time_count
from edo_t_bookview d, supplier_v_books s
where d.book_id=s.book_id 
and s.SUPPLIER_name='sdfdsf' and month='2'
group by s.SUPPLIER_NAME,s.BOOK_NAME,s.isbn,d.user_time
order by time_count desc

解决方案 »

  1.   

    试试这个
    select s.SUPPLIER_NAME,s.BOOK_NAME,s.isbn,to_char(d.user_time,'mm') as month, count(d.user_time) as time_count
    from edo_t_bookview d, supplier_v_books s
    where d.book_id=s.book_id 
    and s.SUPPLIER_name='sdfdsf' and to_char(d.user_time,'mm')='02'
    group by s.SUPPLIER_NAME,s.BOOK_NAME,s.isbn,to_char(d.user_time,'mm')
    order by time_count desc