Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Illogical logical query

Status
Not open for further replies.

brendanj68

IS-IT--Management
Oct 1, 2003
41
GB
Hi,

Having a real problem with this (using SQl2000 with Crystal reports). I have to select all projects starting between 01/04/03 and 31/03/04, no problem, but in addition also have to select project end-dates greater than 01/04/03. Result mainly correct, but still returning the following:


Phase 1 6/3/2002 'Start_Date' 10/31/2002 'End_Date' Assignment Manager <Binary> <Binary> 126388 2002/03 SPS ASG VAL05

5 day Review 10/13/2003 'Start_Date' 10/17/2003 'End_Date' Project manager <Binary> <Binary> 5000 2003/04 SIP GEN EHD

WHERE (dbo.Project.Start_Date BETWEEN CONVERT(DATETIME, '2003-04-01 00:00:00', 102) AND CONVERT(DATETIME, '2004-03-31 00:00:00', 102)) AND
(dbo.Project.Project_Code LIKE 'SCN%') AND (dbo.Project.End_Date > CONVERT(DATETIME, '2004-04-01 00:00:00', 102))

Any help would solve my headache. Cheers
 
Not 100% sure what the problem is but going by your initial requirement, try this:

Code:
WHERE (start_date BETWEEN '20030401' AND '20040331'
  OR end_date > '20030401')
  AND project_code LIKE 'SCN%'

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top