> You can do:
>
>
> SELECT last_name, first_name, phone, if(pub_email="Y",email,"") as email
> FROM `mydatabasetable` WHERE `current_member` = "Y" AND `pub_name` = "Y"
> ORDER BY last_name ASC
>
Gracias, Carlos. This worked fine!
---Fritz
--
MySQL General Mailing List
For list archiv
enstag, 05. Februar 2013 um 15:49 Uhr
Von: cl
An: mysql@lists.mysql.com
Betreff: SELECT subquery problem
De-lurking here.
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,
gt; done via the if(,,)-statement of mysql or by using a union and two selects,
> one for pub_email=n and the other for the rest.
>
>
> Gesendet: Dienstag, 05. Februar 2013 um 15:49 Uhr
> Von: cl
> An: mysql@lists.mysql.com
> Betreff: SELECT subquery problem
> De-lurking here.
De-lurking here.
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