MySQL Forums
Forum List  »  Newbie

Conditional SELECT - is it possible?
Posted by: Paul A
Date: December 09, 2012 01:43PM

I have a fully working query [snipped for brevity]:

items.barcode AS Barcode,
items.year AS Year,
items.yeartwo AS YearTwo,
items.descrip AS Description
LEFT JOIN [etc, etc]
WHERE [etc, etc]

I only need 'YearTwo' IF 'Year' is null/blank, but cannot find the right syntax (along the lines of: "items.yeartwo AS Year WHERE items.year IS NULL" and am trying not to have to export the data into a perl routine. (all data is string, no date format.)

All/any assistance, suggestions would be greatly appreciated. Thanks - Paul.

Options: ReplyQuote

Written By
Conditional SELECT - is it possible?
December 09, 2012 01:43PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.