From: Dan Nelson Date: November 25 2007 4:34am Subject: Re: Default result List-Archive: http://lists.mysql.com/mysql/210182 Message-Id: <20071125043403.GC4226@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In the last episode (Nov 24), Steffan A. Cline said: > Is there anything I am missing that will allow me to return a default row if > the sought after row is not found? > > For example : > > Select * from table1 where column1=1234 > > If 1234 is not found, row1 would be returned instead. > If 1234 is found then that is the row returned. SELECT * FROM ( SELECT * FROM table1 WHERE column1=1234 UNION SELECT * FROM table1 WHERE column1=1 /* or whatever uniquely identifies row1 */ ) t LIMIT 1; -- Dan Nelson dnelson@stripped