Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Mutli Count plus data return

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-01-24 : 09:10:46
Ed writes "I have two tables, userinfo and usage. I need to return from usage 2 counts of logins, one of # of logins prior to a certain date and one of total logins period both based on the users id. In addition I need to return all user info with the counts from userinfo table. The userid is in both tables.
So I would have when complete:

Earlycount,FullCount2,all, users, data,,,,

SQL2k, Win2k all current."

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-01-24 : 09:17:35
You really should provide some ddl so we don't have to do any mind-reading ...


select
sum(case when orderdate < '1/1/97' then 1 else 0 end) as 'pre-97 count',
count(*) as 'total count'
from
northwind.dbo.orders

 


Jay White
{0}
Go to Top of Page
   

- Advertisement -