SQLTeam.com | Weblogs | Forums

Need Help How To Create Summary Report In SQL Server (T-SQL)

sql2012

#1

Hi,
I have two table one is "Collection" and second is "Entry" in both the table have two columns, in Collection table columns (Collection_User, Collection_Date) and in Entry table columns
(Entry_User, Entry_Date) and through join in both the table I want to create summery report but it is not giving me right answer.

See the image

I am using below query, but it is not giving me right answer.

Query:-

select col.Collection_Name,
count(col.Collection_Data) as 'Collection #',
Count(en.entry_date) as 'Entry #'

from collection as col inner join entry as en
on col.Collection_Name=en.Entry_Name
and col.Collection_Data=en.Entry_Date
group by col.Collection_Name

Please help me to achieve right answer.

Thanks
Kashif