Click here to Skip to main content
15,880,905 members
Home / Discussions / Database
   

Database

 
GeneralRE: "Stock Recon" type query .. most efficient route? Pin
francoisdotnet28-Jun-08 12:03
francoisdotnet28-Jun-08 12:03 
GeneralRe: RE: "Stock Recon" type query .. most efficient route? Pin
Paul Conrad28-Jun-08 12:32
professionalPaul Conrad28-Jun-08 12:32 
AnswerRe: "Stock Recon" type query .. most efficient route? Pin
Pete O'Hanlon28-Jun-08 10:57
mvePete O'Hanlon28-Jun-08 10:57 
GeneralRe: "Stock Recon" type query .. most efficient route? Pin
francoisdotnet28-Jun-08 12:06
francoisdotnet28-Jun-08 12:06 
QuestionCount all posts added before or in a specific month Pin
Sunday8PM28-Jun-08 2:38
Sunday8PM28-Jun-08 2:38 
AnswerRe: Count all posts added before or in a specific month Pin
Paul Conrad28-Jun-08 8:08
professionalPaul Conrad28-Jun-08 8:08 
GeneralRe: Count all posts added before or in a specific month Pin
Sunday8PM28-Jun-08 9:06
Sunday8PM28-Jun-08 9:06 
AnswerRe: Count all posts added before or in a specific month [modified] Pin
Luc Pattyn28-Jun-08 9:48
sitebuilderLuc Pattyn28-Jun-08 9:48 
Hi,

Sunday8PM wrote:
YEAR(timestamp) <= YEAR(?date) AND MONTH(timestamp) <= MONTH(?date)


this is logically incorrect; if you want to check date1 < date2
by year and month, you need the equivalent of
year1 < year2 OR (year1==year2 AND month1<month2)>

The way you did it you missed all months that have year1<year2 and month1>=month2


One way of doing it right in a single compare is by combining months and years:
(12*year1 + month1) < (12*year2 + month2)

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Voting for dummies? No thanks. Dead | X|


modified on Saturday, June 28, 2008 4:21 PM

GeneralRe: Count all posts added before or in a specific month Pin
Sunday8PM28-Jun-08 12:23
Sunday8PM28-Jun-08 12:23 
QuestionHelp in writting query Pin
Saiyed Alam27-Jun-08 22:20
Saiyed Alam27-Jun-08 22:20 
AnswerRe: Help in writting query Pin
subai28-Jun-08 20:17
subai28-Jun-08 20:17 
AnswerRe: Help in writting query Pin
Mycroft Holmes28-Jun-08 21:54
professionalMycroft Holmes28-Jun-08 21:54 
GeneralRe: Help in writting query Pin
Kjetil Svendsen1-Jul-08 10:44
Kjetil Svendsen1-Jul-08 10:44 
QuestionSQL Reporting 2005 (SSRS) Matrix Subtotal Color condition Pin
Member 384432027-Jun-08 10:59
Member 384432027-Jun-08 10:59 
QuestionDatabase logic... Pin
KORCARI27-Jun-08 5:10
KORCARI27-Jun-08 5:10 
AnswerRe: Database logic... Pin
Kschuler27-Jun-08 7:18
Kschuler27-Jun-08 7:18 
AnswerRe: Database logic... Pin
Mark Churchill27-Jun-08 17:01
Mark Churchill27-Jun-08 17:01 
AnswerRe: Database logic... Pin
Mycroft Holmes28-Jun-08 21:59
professionalMycroft Holmes28-Jun-08 21:59 
QuestionSQL AGENT x64 version Pin
rafaelq200027-Jun-08 4:45
rafaelq200027-Jun-08 4:45 
Questionselect top query Pin
brettokumar27-Jun-08 3:41
professionalbrettokumar27-Jun-08 3:41 
AnswerRe: select top query Pin
Colin Angus Mackay27-Jun-08 3:48
Colin Angus Mackay27-Jun-08 3:48 
GeneralRe: select top query Pin
SomeGuyThatIsMe27-Jun-08 9:00
SomeGuyThatIsMe27-Jun-08 9:00 
GeneralRe: select top query Pin
Pete O'Hanlon27-Jun-08 11:02
mvePete O'Hanlon27-Jun-08 11:02 
AnswerRe: select top query Pin
Ashfield27-Jun-08 3:51
Ashfield27-Jun-08 3:51 
AnswerRe: select top query [modified] Pin
SomeGuyThatIsMe27-Jun-08 8:58
SomeGuyThatIsMe27-Jun-08 8:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.