Forum Home
Press F1
 
Thread ID: 97873 2009-03-02 22:10:00 Help with Access query Tony (4941) Press F1
Post ID Timestamp Content User
752780 2009-03-02 22:10:00 This has got to be easy, but I can't get it to go.

I have a table "tblMembers" that has a date field "memJoinDate", and all the other membership-type fields you might expect. I am trying to construct a query that returns the count of the members with a join date later than 1/12/2007.

How hard can that be? :badpc: A bit of SQL would be greatly appreciated.

TIA
Tony (4941)
752781 2009-03-02 22:29:00 >1/12/2007

www.imagef1.net.nz
Bantu (52)
752782 2009-03-02 22:41:00 Well, yes, I can do that bit - it is combining that with the count that has me stumped. Tony (4941)
752783 2009-03-02 23:00:00 Either do a subquery first which applies the date criteria, and then do a count of the records passed through from that subquery,

Or turn on the aggregate functions in your query by clicking the Totals button, and enter the date field twice, once with it set to Count, and the second one set to Where, with the date criteria in this one. You can't have the member names in there for an aggregate query, or it will try to do a Group By on that field, which won't work:


SELECT Count(mbr_join.Join_date) AS CountOfJoin_date
FROM mbr_join
WHERE (((mbr_join.Join_date)>#12/1/2007#));
nofam (9009)
752784 2009-03-02 23:06:00 Bingo! It was the "where" I'd omitted. I basically had the right idea, but couldn't formulate the criteria correctly. Thanks. :thumbs: Tony (4941)
1