How do I write SQL for this scenario -


lets consider orders table in northwind database , need count of order records year 1997 , 1998 in single query how do this?

i tried thing this...

select count(o.orderid) 'count of orders 1997', count(o1.orderid) 'count of orders 1998' orders o inner join orders o1 on o.orderid = o1.orderid year(o.orderdate) = 1997 or year(o1.orderdate) = 1998 

please me in this...

select count(o.orderid) 'count of years' orders o    year(o.orderdate) = 1997 or year(o1.orderdate) = 1998  group year(o.orderdate) 

Comments

Popular posts from this blog

sql - text truncated using perl DBI insert -

c++ - Is it possible to compile a VST on linux? -

php - Pass object by reference or value -