SQLTeam.com | Weblogs | Forums

Trying to use conditions in WHERE


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'.

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


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


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


usually something like:

where mydate >= startdate and mydate < enddate + 1


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

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

should be:

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


@Jim, really? This is much simpler:

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


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.


You should post in a firebird forum