On Thu, 15 Aug 2002 10:37, you wrote:
> Is there a way to combine these queries?
>
> SELECT count(SeekID) FROM Seekers
> WHERE DateLastLog<NOW() AND DateLastLog>(NOW()-INTERVAL 7 DAY)
>
> SELECT count(SeekID) FROM Seekers
> WHERE DateLastLog<NOW() AND DateLastLog>(NOW()-INTERVAL 1 MONTH)
SELECT
SUM(DateLastLog > (NOW()-INTERVAL 7 DAY)) AS Count7Days,
SUM(DateLastLog > (NOW()-INTERVAL 1 MONTH)) AS Count1Month
FROM
Seekers
WHERE
DateLastLog < NOW()
;
> Or these?
>
> SELECT count(ResumeID) FROM Resumes WHERE testResume='1'
> SELECT count(ResumeID) FROM Resumes WHERE HighRank='1'
SELECT
SUM(testResume='1'),
SUM(HighRank='1')
FROM
Resume
;
Basically in both cases you make (very ugly!) use of the fact that boolean
expressions evaluate to '1' for true, and '0' for false.
Regards,
Jerry
MySQL, SQL
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php