> 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
2006/6/5, MySQL Nexeia <[EMAIL PROTECTED]>:
I face one problem with mysql4.0
I've two tables, one called company and the other called favorites. The
relation between those two tables is CO_ID on the company table and
MASTER_CO_ID on the favorites table. When I run the following query it works
f
I face one problem with mysql4.0
I've two tables, one called company and the other called favorites. The
relation between those two tables is CO_ID on the company table and
MASTER_CO_ID on the favorites table. When I run the following query it works
fine on mysql-5.0 but it give error with mysql
x27;
http://dev.mysql.com/doc/mysql/en/UPDATE.html
Regards,
Lachlan
-Original Message-
From: prolist [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 10 August 2004 3:52 PM
To: [EMAIL PROTECTED]
Subject: Update with subquery problem
I am trying to update a related table with a subquery. This is
Subqueries are not supported until mysql 4.1. I'm guessing you have an
earlier version. With version 4.0.4 or later, you can accomplish the same
thing with a multi-table update:
UPDATE tbl1, tbl2 SET tbl1.col1 = tbl1.col1 + 1
WHERE tbl1.ID = tbl2.ID AND tbl2.status='Active';
or equivalentl
I am trying to update a related table with a subquery. This is what I am
using -
update tbl1 set col1=col1+1 where ID IN (select ID from tbl2 where
status='Active');
But I get syntax error. I am not much of a database guy, so can't understand
what am I doing incorrectly. Can someone help?
TIA,
-
Subqueries aren't implemented in 4.0 - only 4.1 and upwards support
subqueries.
Cheers
Andrew.
- Original Message -
From: "nambi c" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 22, 2004 10:31 PM
Subject: subquery problem.
> Hi,
>
Version 4.0 doesn't support subqueries.
In any event, your query would return all rows from
channels as long as there are any rows in users, which
I doubt is what you intended.
--- nambi c <[EMAIL PROTECTED]> wrote:
> Hi,
>
> My server version : 4.0.18-max-nt
>
> I have created 2 tables 'chan
Hi,
My server version : 4.0.18-max-nt
I have created 2 tables 'channels' and 'users' in my
database. I can query these tables individually. I am
trying to execute a query with 'exists' clause.
mysql> select * from channels where exists (select *
from users);
This give the following error.
ER
12 matches
Mail list logo