plook
IS-IT--Management
- Apr 1, 2000
- 33
Good morning,
I would like to do something similar to...
---------
SELECT tableA.field1,tableB.field1,
tableA.field2,tableB.field2
FROM tableA,tableB
IF tableA.field1=1 THEN (
WHEN tableA.field2 = tableB.field2)
ELSE (
WHEN tableA.field1=tableB.field1
tableA.field2=tableB.field2)
----------------
But...I always get the error "syntax error near keywork 'THEN' " when I run this little query.
I tried to find the solution in some books, but I have yet to find a book that talks about IF statements...so I'm no longer sure IF statements exist in SQL...
Thanks for your help..
Dominic
Happy New Year to you all
I would like to do something similar to...
---------
SELECT tableA.field1,tableB.field1,
tableA.field2,tableB.field2
FROM tableA,tableB
IF tableA.field1=1 THEN (
WHEN tableA.field2 = tableB.field2)
ELSE (
WHEN tableA.field1=tableB.field1
tableA.field2=tableB.field2)
----------------
But...I always get the error "syntax error near keywork 'THEN' " when I run this little query.
I tried to find the solution in some books, but I have yet to find a book that talks about IF statements...so I'm no longer sure IF statements exist in SQL...
Thanks for your help..
Dominic
Happy New Year to you all