RE: SELECT subquery problem

2013-02-06 Thread cl
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 archives:

SELECT subquery problem

2013-02-05 Thread cl
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

Re: SELECT subquery problem

2013-02-05 Thread Andrew Moore
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 c...@nimbleeye.com An: mysql@lists.mysql.com Betreff: SELECT subquery problem De-lurking here. I am trying to figure out

Aw: SELECT subquery problem

2013-02-05 Thread Stefan Kuhn
. Februar 2013 um 15:49 Uhr Von: cl c...@nimbleeye.com 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

Subquery Problem With mysql-4.0 (Works with mysql-5.0)

2006-06-05 Thread MySQL Nexeia
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

Re: Subquery Problem With mysql-4.0 (Works with mysql-5.0)

2006-06-05 Thread Pooly
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

Re: Update with subquery problem

2004-08-10 Thread Michael Stassen
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

RE: Update with subquery problem

2004-08-10 Thread Lachlan Mulcahy
://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 what I am

Update with subquery problem

2004-08-09 Thread prolist
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,

subquery problem.

2004-07-22 Thread nambi c
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.

Re: subquery problem.

2004-07-22 Thread Justin Swanhart
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 'channels'

Re: subquery problem.

2004-07-22 Thread Andrew Pattison
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, My server version : 4.0.18-max-nt I