Skip navigation links

MySQL Forums :: Newbie :: Conditional SELECT - is it possible?


Advanced Search

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

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

SELECT
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


Subject Written By Posted
Conditional SELECT - is it possible? Paul A 12/09/2012 01:43PM
Re: Conditional SELECT - is it possible? Peter Brawley 12/09/2012 02:23PM
Re: Conditional SELECT - is it possible? Paul A 12/09/2012 02:58PM
Re: Conditional SELECT - is it possible? Peter Brawley 12/09/2012 03:21PM
Re: Conditional SELECT - is it possible? Paul A 12/09/2012 04:30PM


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.