John Baird
Coatesville, Pennsylvania, United States
General information
Category:
Coding, syntax and commands
>Hi.
>I want to select from avtable , based on a Parameter (Say X)
>e.g. If Parameter = Blank, select all records, else select where a Filed eqauls parameter value
>
>In VFP, following works:
>SELECT * FROM MyTable WHERE IIF(X= " ",.t.,REF == X)
>
>Can something similar be done in Sql (Above simplified version... I could have 5 Where conditions)
>Tia
>Gerard
I would use a CASE statement:
SELECT CASE x
WHERE '' THEN true
WHERE .. THEN ..
WHERE .. THEN ..
ELSE X
END AS myField
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only