OR in WHERE
keatk at comcast.net
keatk at comcast.net
Thu May 20 15:55:03 CDT 2004
> If I have understand correctly query must be
>
> SELECT iId
> FROM infos, questions A, questions B
> WHERE
> A.introId = infos.iId AND
> infos.iId = A.infoId
But does OR in WHERE caluse work? I had some code using V4RB 1.1 where it does not seem to... Though it may have bene using somethink like "Where Field1 = 'XXXXXX" OR VObjectPtrField = 4", but I can't be sure now.. It's been awhile.
I reworte my code using the OR to merge the data from tw0 seperate cursors in RB
- Karen
> On 5/20/04 5:46 PM, "Andrew Sinning" <andrew at learningware.com> wrote:
>
> > 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)
>
> If I have understand correctly query must be
>
> SELECT iId
> FROM infos, questions A, questions B
> WHERE
> A.introId = infos.iId AND
> infos.iId = A.infoId
>
>
> --
> Best regards,
> Ruslan Zasukhin [ I feel the need...the need for speed ]
> -------------------------------------------------------------
> e-mail: ruslan at paradigmasoft.com
> web: http://www.paradigmasoft.com
>
> To subscribe to the Valentina mail list go to:
> http://lists.macserve.net/mailman/listinfo/valentina
> -------------------------------------------------------------
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
More information about the Valentina
mailing list