OR in WHERE
Andrew Sinning
andrew at learningware.com
Thu May 20 09:46:54 CDT 2004
I never saw a response from the question below. Ruskin, can you please
help me out?
Thanks.
Andrew
-----Original Message-----
From: valentina-bounces at lists.macserve.net
[mailto:valentina-bounces at lists.macserve.net]On Behalf Of Andrew Sinning
Sent: Monday, May 17, 2004 12:27 PM
To: Valentina Developers
Subject: OR in WHERE
I think that I've read that this is broken, but I'm just not smart
enough to think of another way to write this sql statement. Perhaps
with a little help I'll catch on.
I have two tables 'questions' and 'infos'.
questions.infoId
and
questions.introId
can either be related to infos.iId
I want to find all the info that correspond to either an infoId OR an
introId in questions
-- looking for JUST the infoId's, works just fine:
sql = "SELECT iId FROM infos, questions WHERE questions.infoId =
infos.iId"
put dbQuery(sql)
-- [[#iID: 98], [#iID: 101], [#iID: 94], [#iID: 73], [#iID: 74], [#iID:
75], [#iID: 76], [#iID: 77], [#iID: 78], [#iID: 79], [#iID: 80], [#iID:
81], [#iID: 82], [#iID: 83], [#iID: 84], [#iID: 85], [#iID: 86], [#iID:
87], [#iID: 88], [#iID: 89], [#iID: 90], [#iID: 91], [#iID: 92]]
-- looking for JUST the introId's, works just fine:
sql = "SELECT iId FROM infos, questions WHERE questions.introId =
infos.iId"
put dbQuery(sql)
-- [[#iID: 96], [#iID: 99], [#iID: 93]]
BUT, now I need to combine the two, and I get no result:
sql = "SELECT iId FROM infos, questions WHERE (questions.infoId =
infos.iId) OR (questions.introId = infos.iId)"
put dbQuery(sql)
-- []
_______________________________________________
Valentina mailing list
Valentina at lists.macserve.net
http://lists.macserve.net/mailman/listinfo/valentina
More information about the Valentina
mailing list