r3nder
asked on
sql select giving wrong data
I have a query that is not returning what I expected - why? why is it returning the -1
SELECT j.JobID,jde.ToolNumber,'TN' as ToolType, j.DefaultLocationIndex as 'Location'
FROM Job j
LEFT JOIN JobDownholeEquipment jde ON j.JobID = jde.JobID
WHERE j.JobInProgress= 'true'
OR j.JobInitiated= 'true'
AND jde.PickedUp = 0
AND j.DefaultLocationIndex = 4
[embed=file 904777]
Capture.PNG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
FROM Job j
LEFT JOIN JobDownholeEquipment jde ON j.JobID = jde.JobID
WHERE( j.JobInProgress= 'true'
OR j.JobInitiated= 'true')
AND jde.PickedUp = 0
AND j.DefaultLocationIndex = 4