Friday, February 10, 2012

best way of doing this count?

Hi ,

I have a table called Items.. this stored a RecordID and title..

then I have a tbl called listings.. this shows the linked RecordID, a startdate and a enddate

I need to show all the Items... then do a count for all records in the listings table (i.e showing the number of listings for an item - pretty easy).. however I also need to show a result for all the listings that have no enddate (i.e are still on-going)

so I'll end up with

RecordID ListingCount LiveListingCount

1 9 7

2 6 3

I did think of using a nested select in a count statement on the main select statement but couldn't get the syntax right.. anyone point me in the right direction?

I've managed to do it......

No comments:

Post a Comment