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

Re: Conditional selects



i think that you must use the where dynamic  for example:
if $field2 = '1' 
    let $where=' field2 =  $selectedValue '
end-if
begin-select
a
b
from tablea
where [$where]
end-select
 

Juan Manuel Alvarado   
E-BUSINESS UNIT
Brio/Microsoft
Gerencia & Sistemas , Guatemala

"E-SPC IS E-BUSINESS"

-----Original Message-----
From: Andrew Rivers [mailto:andrew.rivers@CWCOM.NET]
Sent: Tuesday, May 30, 2000 3:54 PM
To: SQR-USERS@list.iex.net
Subject: Conditional selects

Hi
In SQR it is possible to make a conditional select by passing in a variable into the where clause:
e.g.
...
...
let $selectedValue = 'valueSelected'
begin-select
field1
field2
field3
...
from tablename where field2 =  $selectedValue
end-select
...
 
                        ***************************************************************
However, I need to select on whether field1 is null or field1 is equal to a particular value
i.e,
...
let $selectedValue = 'valueSelected'
begin-select
field1
field2
field3
...
from tablename where     field2 is null
                                     field2 = $selectedValue
end-select
...
 
Somehow, I think that it should be possible to pass in a string/string literal...
        ...but so far I have drawn a blank...
 
Am I chasing moonbeams?
Is it possible? Or am I wasting my time?
 
Thanks.
 
Andrew
********