Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie question

Status
Not open for further replies.

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
 
Thank you very much Chelandrew !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top