| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Jerry van Leeuwen | Date: | August 15 2002 2:12am |
| Subject: | Re: Combining queries | ||
| View as plain text | |||
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
| Thread | ||
|---|---|---|
| • Speed problems.. Still | Richard Baskett | 15 Aug |
| • Re: Speed problems.. Still | Keith C. Ivey | 15 Aug |
| • Re: Speed problems.. Still | Richard Baskett | 15 Aug |
| • Re: Speed problems.. Still | Keith C. Ivey | 15 Aug |
| • Re: Speed problems.. Still | Richard Baskett | 15 Aug |
| • Re: Speed problems.. Still | Keith C. Ivey | 15 Aug |
| • Combining queries | Richard Baskett | 15 Aug |
| • Re: Combining queries | Paul DuBois | 15 Aug |
| • Re: Speed problems.. Still | Benjamin Pflugmann | 15 Aug |
| • Re: Speed problems.. Still | Simon Windsor | 15 Aug |
| • Re: Speed problems.. Still | Rahadul Kabir | 15 Aug |
| • Re: Speed problems.. Still | Richard Baskett | 15 Aug |
| • Re: Combining queries | Jerry van Leeuwen | 15 Aug |
