I am trying to figure out how to return results from a query. What I need to do is to return 4 columns from a database. This is easy:
SELECT last_name, first_name, phone, email FROM `mydatabasetable` WHERE `current_member` = "Y" AND `pub_name` = "Y" ORDER BY last_name ASC
This works fine, as expected.
But, I want to only display the value in `email` if the value in another field, `pub_email` = "Y" So, the resultant output would look like this, for instance, if the value of `pub_email` ="N" for Mr. Wills:
Jones John 555-555-5555 johnjones@nowhere.com Smith Jim 555-222-2222 jimSmith@nothing.com Wills Chill 555-111-1111 Zorro Felicity 555-999-9999 felicityzorro@madeup.com
Can't quite figure out how to express this.
TIA for your suggestions!
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql
Feb 05
Carlos Eduardo Caldi RE: SELECT subquery problem
Feb 05, 2013; 13:14
Carlos Eduardo Caldi
RE: SELECT subquery problem
Feb 05
Andrew Moore Re: SELECT subquery problem
Feb 05, 2013; 15:43
Andrew Moore
Re: SELECT subquery problem
Feb 05
Andy Wallace Re: SELECT subquery problem
Feb 05, 2013; 09:10
Andy Wallace
Re: SELECT subquery problem
Feb 06
=?utf-8?Q?cl?= RE: SELECT subquery problem
Feb 06, 2013; 11:30
=?utf-8?Q?cl?=
RE: SELECT subquery problem
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!