SQLTeam.com | Weblogs | Forums

Trying to use conditions in WHERE


#1

select username,sum(woitem.qtytarget) as total
from item
join wo
ON wo.id = item.woid
JOIN part ON item.partid = part.id
Join moitem
on moitem.id = item.moitemid
Join mo
ON mo.id = moitem.moid
LEFT JOIN SYSUSER ON mo.userid = sysuser.id
where username = 'XXX'
group by username

I want to use multiple conditions in where.AND doesnt work in firebird? I want to use many conditions. example - where username = 'xxx', 'yyy', 'zzz'.


#2
 where username in ('xxx', 'yyy', 'zzz')

#3

That works. How can we use Date Constraint in SQL?


#4

Is there a firebird forum? You might have more luck there given that this is specifically a Microsoft SQL Server forum :smile:


#5

usually something like:

where mydate >= startdate and mydate < enddate + 1

#6

Essentially, you have to do an expression on either side of the AND.

where username = 'xxx', 'yyy', 'zzz'

should be:

WHERE
username = 'xxx' OR
username = 'yyy' OR
username = 'zzz'


#7

@Jim, really? This is much simpler:

where username in ('xxx', 'yyy', 'zzz')

#8

I need to extract data between 2 dates. Eg: where date between 'sep 23,2015' and 'sep 24,2015'

But it doesnt work in firebird.


#9

You should post in a firebird forum