Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - most acitve users
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

most acitve users

 Post Reply Post Reply
Author
leiti View Drop Down
Groupie
Groupie


Joined: 16 February 2005
Status: Offline
Points: 65
Post Options Post Options   Thanks (0) Thanks(0)   Quote leiti Quote  Post ReplyReply Direct Link To This Post Topic: most acitve users
    Posted: 18 June 2008 at 7:22am
Hello,
 
i am searching for two sql scripts -> both for a Access DB:
 
first one (the simple one):
all user with their number of posts:
 
SELECT A.Username, COUNT(T.Author_ID) FROM tblAuthor A,  tblThread T
WHERE A.Author_ID = T.Author_ID
GROUP BY A.Username
ORDER BY COUNT(T.Author_ID) DESC
 
second one:
all user with their number of posts between a date:
 
SELECT A.Username, COUNT(T.Author_ID) FROM tblAuthor A,  tblThread T
WHERE A.Author_ID = T.Author_ID
AND T.Message_Date BETWEEN #01/06/2005# AND #30/06/2005#
GROUP BY A.Username
ORDER BY COUNT(T.Author_ID) DESC
 
The first script is working fine - but the second one wont bring the correct result. Can anyone take a view about it?
Back to Top
Jono View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 18 September 2006
Location: United Kingdom
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jono Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2008 at 9:48am
I'm not an Access expert, but it may be that access is looking for a US format date (see: http://www.webmasterworld.com/databases_sql_mysql/3480321.htm).
Does Access support ISO dates? (i.e. yyyy-mm-dd) If so, that would ensure there is no confusion.
When you say "correct results" does it return any records? If so, what are the values of "Message_Date" (you'll need to add this to the select statement)?
Back to Top
leiti View Drop Down
Groupie
Groupie


Joined: 16 February 2005
Status: Offline
Points: 65
Post Options Post Options   Thanks (0) Thanks(0)   Quote leiti Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2008 at 10:51am
Thanks you are right - that was the solution ;-)
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2008 at 11:09am
I tend to use ISO dates for all database queries now, it also helps prevent issues between different date settings on servers.

The only database server I have come across that does understand the ISO yyyy-mm-dd date is SQL Server 2000 were you need to remove the dashes eg yyyymmdd, although Microsoft fixed this with SQL Server 2005.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.