[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Switching in the Where Clause



Try a union for simple readability:

Select Blah...
>From MyTable
Where field1 > 6
     and field2 > 'm'
     and field3 <> 'sold'  !CONTAINS A QUOTED REFERENCE
AND ROWTYPE = 'A'

UNION

Select Blah...
>From MyTable
Where field1 > 6
     and field2 > 'm'
AND ROWTYPE = 'B'


John M. Doel
Consultant
PeopleSoft Consulting USA
Phone: (877) 339-2982



                    NEDOLPH@AOL.CO
                    M                     To:     SQR-USERS@list.iex.net
                    Sent by:              cc:
                    "Discussion of        Subject:     Switching in the Where 
Clause
                    SQR, Brio
                    Technology's
                    database
                    reporting
                    language"
                    <SQR-USERS@lis
                    t.iex.net>


                    09/11/00 01:56
                    PM
                    Please respond
                    to sqr-users







Assume I have a MyTable of 1500 rows; some of RowType = "A" and some of
RowType = "B"...

For the "A" rows I want to:

Select Blah...
>From MyTable
Where field1 > 6
     and field2 > 'm'
     and field3 <> 'sold'  !CONTAINS A QUOTED REFERENCE

for the "B" rows, I want to suppress the last line of the WHERE clause to
make:

Select Blah...
>From MyTable
Where field1 > 6
     and field2 > 'm'

I tried switching the last clause in and out with an IF statement (IF
Rowtype = 'A' ...) but that failed miserably.  What am I doing wrong?

Sincerely,
Norman Dolph