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 archiv

Aw: SELECT subquery problem

2013-02-05 Thread Stefan Kuhn
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,

Re: SELECT subquery problem

2013-02-05 Thread Andrew Moore
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.

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: 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 f

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 mysql

RE: Update with subquery problem

2004-08-09 Thread Lachlan Mulcahy
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

Re: Update with subquery problem

2004-08-09 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 equivalentl

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, -

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, >

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 'chan

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. ER