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!

Quick SQL syntax check (hopefully!)

Status
Not open for further replies.

declanwmagee

Technical User
Jul 3, 2010
2
GB
Can anyone tell me what's wrong with this SQL expression?

The error message is just a syntax error, so I'm sure it's easy if you speak SQL...

SELECT CASE WHEN "Variety" <> '' THEN "Date" || "Denomination" || "Variety" ELSE "Date" || "Denomination" END AS "Concat", "InventoryID" FROM "tblInventory
 
as far as ANSI SQL is concerned, i believe there is no error

so if you're getting a syntax error, it's because your particular database system isn't completely ANSI-compliant

what database system are you actually running, and what was the exact error message?

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Thank you r937, for your response! I'm using OpenOffice Base 3.2, as I'm Access-phobic, and I'm trying to break away from Excel now that my lovely old database is too complex and too big for it. Too much time spent watching it recalculate.

Turns out that I'd be better off using a COALESCE statement than the CASE or CASEWHEN. OOBase would have been OK with CASEWHEN, apparently, but COALESCE is much tidier, and it works!

thanks a lot, and I'm sure this isn't the last you'll hear from me!

Declan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top