OR in WHERE

Andrew Sinning andrew at learningware.com
Thu May 20 10:58:48 CDT 2004


Ruskin,

The query which you provided uses an AND, and results in cases where
BOTH cases match.

I need the cases where EITHER case matches.

Valentina is a very good product, the bug with OR in WHERE not working
is very significant.  I need to understand both a theory and a method
for a work around of the OR bug.  Please help me.

Regards,

Andrew



-----Original Message-----
From: valentina-bounces at lists.macserve.net
[mailto:valentina-bounces at lists.macserve.net]On Behalf Of Ruslan
Zasukhin
Sent: Thursday, May 20, 2004 10:02 AM
To: valentina at lists.macserve.net
Subject: Re: OR in WHERE


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