Re: Subqueries in the FROM Clause

2011-04-18 Thread Ants Pants
On 18 April 2011 20:19, Joerg Bruehe wrote: > Hallo everybody! > > > Ants Pants wrote: > > Hello All, > > > > Tables: > > # relevant fields > > invitations: donation_pledge, paid (boolean), currency_id > > currencies: code > > > > > > I am trying to subtract the paid amounts from the amounts pled

Re: Subqueries in the FROM Clause

2011-04-18 Thread Joerg Bruehe
Hallo everybody! Ants Pants wrote: > Hello All, > > Tables: > # relevant fields > invitations: donation_pledge, paid (boolean), currency_id > currencies: code > > > I am trying to subtract the paid amounts from the amounts pledged using a > subquery in the FROM clause but am having problems an

Re: Subqueries in MySQL < 4.1

2006-08-23 Thread Jay Pipes
On Wed, 2006-08-23 at 22:23 +0200, spacemarc wrote: > Hi, > I have a query like this: > > SELECT table1.*,( > SELECT COUNT( field2 ) > FROM table2 > WHERE id=10 > ) AS total > FROM table1 > GROUP BY id > LIMIT 1 > > but the subqueries do not work with mysql < 4.1. How can I convert it > (or make

Re: Subqueries in MySQL < 4.1

2006-08-23 Thread Dan Buettner
See http://dev.mysql.com/doc/refman/5.0/en/rewriting-subqueries.html for some tips Dan On 8/23/06, spacemarc <[EMAIL PROTECTED]> wrote: Hi, I have a query like this: SELECT table1.*,( SELECT COUNT( field2 ) FROM table2 WHERE id=10 ) AS total FROM table1 GROUP BY id LIMIT 1 but the subqueries

Re: subqueries *not* using indexes for IN clause

2005-04-04 Thread Kevin A. Burton
Greg Whalin wrote: We have noticed this as well and it is really pretty shoddy. It seems that when using IN( SELECT ), they treat it as ANY() which does a full table scan. Only way we have found to get fast performance out of subqueries is to use the derived table format and join with the

Re: subqueries *not* using indexes for IN clause

2005-04-04 Thread Greg Whalin
We have noticed this as well and it is really pretty shoddy. It seems that when using IN( SELECT ), they treat it as ANY() which does a full table scan. Only way we have found to get fast performance out of subqueries is to use the derived table format and join with the derived table. But

Re: SubQueries

2005-01-20 Thread SGreen
You must be having a problem with your email client as this is about the ninth time I have seen this same request today. Please check your client for problems. I know because I have responded once already. Shawn Green Database Administrator Unimin Corporation - Spruce Pine <[EMAIL PROTECTED]> w

Re: SubQueries

2005-01-20 Thread SGreen
sday, December 08, 2004 9:28 PM > To: Lakshmi NarasimhaRao (WT01 - TELECOM SOLUTIONS) > Cc: mysql@lists.mysql.com > Subject: Re: SubQueries > > Since 4.0.22 does NOT have subqueries, you will have to use a JOIN > http://dev.mysql.com/doc/mysql/en/JOIN.html > http://d

Re: SubQueries

2004-12-08 Thread SGreen
Since 4.0.22 does NOT have subqueries, you will have to use a JOIN http://dev.mysql.com/doc/mysql/en/JOIN.html http://dev.mysql.com/doc/mysql/en/Rewriting_subqueries.html ... as in this example SELECT PAGE_SERVICE.TIMEOUT , PAGE_SERVICE.PAGE_SERVICE_COMMENT , PAGE_SERVIC

Re: Subqueries and JOIN

2004-10-28 Thread SGreen
I believe this will work as you want: select h1.* FROM hist h1 LEFT JOIN hist h2 on h1.tel = h2.tel and h2.date_h < '20041027' where h1.date_h = '20041027' and h2.tel is null; This query should return all of the rows from the hist table where the tel value appears for the date yo

Re: Subqueries in version 4.1

2003-11-10 Thread Egor Egorov
Wouter Coppieters <[EMAIL PROTECTED]> wrote: > > We installed version 4.1.0-alpha-max-nt and try to run a query with a > subquery and get the message > > [DB_BAS_LOCAL] ERROR 1235: This version of MySQL doesn't yet support 'LIMIT > & IN/ALL/ANY/SOME subquery' > > > Are subqueries supporeted i

Re: SubQueries and IN

2003-09-08 Thread Egor Egorov
Sebastian Tobias Mendel genannt Mendelsohn <[EMAIL PROTECTED]> wrote: >>>SELECT product_id, name, description, sales.sale_id >>>FROM products LEFT JOIN sales ON products.product_id = sales.product_id >>>WHERE sales.customer_id = 10 AND sales.sale_id IS NULL >> >> >> This query should return no ro

Re: SubQueries and IN

2003-09-08 Thread Sebastian Tobias Mendel genannt Mendelsohn
SELECT product_id, name, description, sales.sale_id FROM products LEFT JOIN sales ON products.product_id = sales.product_id WHERE sales.customer_id = 10 AND sales.sale_id IS NULL This query should return no rows, because if you retrieve rows where sales.sale_id is NULL, customer_id for these rows

Re: SubQueries and IN

2003-09-08 Thread Egor Egorov
"Andy Hall" <[EMAIL PROTECTED]> wrote: > > I have just started using MySQL from MSSQL 7. I need to port the following > into MySQL from an existing (working) query on MSSQL Server: > > SELECT product_id, name, description > FROM products > WHERE product_id NOT IN (SELECT product_id FROM sales WHE

Re: SubQueries and IN

2003-09-08 Thread Andy Hall
> > > You need to get the conditions for the LEFT JOIN out of the WHERE clause: > > SELECT product_id, name, description, sales.sale_id > FROM products > LEFT JOIN sales ON > products.product_id = sales.product_id WHERE > sales.sale_id IS NULL AND > sales.customer_id = 10 > I lied

Re: SubQueries and IN

2003-09-08 Thread Andy Hall
Thanks for the query suggestions, but unfortunately none of them seem to do the trick. Not possible to upgrade to 4.x at the moment, so I am going to have to do it in 2 queries; one to get the list of ID's, then create a list in PHP and drop it into the second query. Thanks for the help! Andy Ha

Re: SubQueries and IN

2003-09-08 Thread Roger Baklund
* Andy Hall > I have just started using MySQL from MSSQL 7. I need to port the following > into MySQL from an existing (working) query on MSSQL Server: > > SELECT product_id, name, description > FROM products > WHERE product_id NOT IN (SELECT product_id FROM sales WHERE customer_id = > 10) > > i.e.

Re: SubQueries and IN

2003-09-08 Thread Chris Boget
> sub-queries, but also seen examples of it done. Is it only supported in a > later version? We are running v. 3.23.3. As far as I know, subqueries are only supported in MySQL v4(.1?)+ Chris -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http:/

RE: SubQueries and IN

2003-09-08 Thread Fortuno, Adam
Andy: Sub queries are supported as of version 4.1 (see link #1). As for your query, double-check the syntax in the select piece. Specifically take out the 'sales.sale_id' and anything else from the 'sales' table. Then try again. Regards, Adam Link #1 - http://www.mysql.com/doc/en/ANSI_diff_Subqu

Re: SubQueries and IN

2003-09-08 Thread Sebastian Tobias Mendel genannt Mendelsohn
Andy Hall wrote: Hi, I have just started using MySQL from MSSQL 7. I need to port the following into MySQL from an existing (working) query on MSSQL Server: SELECT product_id, name, description FROM products WHERE product_id NOT IN (SELECT product_id FROM sales WHERE customer_id = 10) i.e. get al

Re: SubQueries and Temp Tables

2002-06-27 Thread Gerald Clark
RDBMSs. Give us a >break. > >>-Original Message- >>From: Andrew Houghton [mailto:[EMAIL PROTECTED]] >>Sent: Thursday, June 27, 2002 9:10 AM >>To: Dave Morse >>Cc: 'Paul DuBois'; 'Arul'; [EMAIL PROTECTED]; 'MySQL' >>Subjec

RE: SubQueries and Temp Tables

2002-06-27 Thread Dave Morse
[EMAIL PROTECTED]] > Sent: Thursday, June 27, 2002 9:10 AM > To: Dave Morse > Cc: 'Paul DuBois'; 'Arul'; [EMAIL PROTECTED]; 'MySQL' > Subject: Re: SubQueries and Temp Tables > > > It makes sense to many, or most, I'd say. Oracle produce

Re: SubQueries and Temp Tables

2002-06-27 Thread Frank Gates
ource" server in C and a > client in Java makes sense, I guess to some. > > > -Original Message- > > From: Paul DuBois [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, June 26, 2002 5:37 PM > > To: Dave Morse; 'Arul'; [EMAIL PROTECTED] > > Cc:

Re: SubQueries and Temp Tables

2002-06-27 Thread Andrew Houghton
ednesday, June 26, 2002 5:37 PM >>To: Dave Morse; 'Arul'; [EMAIL PROTECTED] >>Cc: 'MySQL' >>Subject: RE: SubQueries and Temp Tables >> >> >>At 7:16 -0700 6/26/02, Dave Morse wrote: >> >>>MySQL is barely an SQL database - it doesn'

RE: SubQueries and Temp Tables

2002-06-27 Thread Paul DuBois
a, do you require a Web server to be written in Java before you'll connect to it? > >> -Original Message- >> From: Paul DuBois [mailto:[EMAIL PROTECTED]] >> Sent: Wednesday, June 26, 2002 5:37 PM >> To: Dave Morse; 'Arul'; [EMAIL PROTECTED]

RE: SubQueries and Temp Tables

2002-06-27 Thread Dave Morse
; [EMAIL PROTECTED] > Cc: 'MySQL' > Subject: RE: SubQueries and Temp Tables > > > At 7:16 -0700 6/26/02, Dave Morse wrote: > >MySQL is barely an SQL database - it doesn't support much > basic SQL 89 > >functionality. Can any one throw some light on why profes

RE: SubQueries and Temp Tables

2002-06-26 Thread Paul DuBois
At 7:16 -0700 6/26/02, Dave Morse wrote: >MySQL is barely an SQL database - it doesn't support much basic SQL 89 >functionality. Can any one throw some light on why professional SQL >database developers want to use it for anything but simple file >management? AND It is written in C as well so why

Re: SubQueries and Temp Tables

2002-06-26 Thread Alexander Barkov
gt; - Original Message - > From: "Ralf Narozny" <[EMAIL PROTECTED]> > To: "Arul" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]>; "MySQL" <[EMAIL PROTECTED]> > Sent: Wednesday, June 26, 2002 3:00 PM > Subject: Re: SubQuerie

RE: SubQueries and Temp Tables

2002-06-26 Thread Dave Morse
MySQL is barely an SQL database - it doesn't support much basic SQL 89 functionality. Can any one throw some light on why professional SQL database developers want to use it for anything but simple file management? AND It is written in C as well so why do Java developers use it? Regards, Dave

Re: SubQueries and Temp Tables

2002-06-26 Thread Arul
;MySQL" <[EMAIL PROTECTED]> Sent: Wednesday, June 26, 2002 3:00 PM Subject: Re: SubQueries and Temp Tables > Hiho hiho! > > Which joins could that be? I think most if not all subqueries should be > replacable with joins. > > Greetings > Ralf > > Arul wrote

Re: SubQueries and Temp Tables

2002-06-26 Thread Ralf Narozny
Hiho hiho! Which joins could that be? I think most if not all subqueries should be replacable with joins. Greetings Ralf Arul wrote: >Hi All > > I am currently porting our application from Oracle to MySQL. >We have some subqueries in oracle which cannot be ported into MySQL.We even >tried so

Re: SubQueries

2002-05-29 Thread Egor Egorov
Arul, Wednesday, May 29, 2002, 1:05:02 PM, you wrote: A> i am running MySql 3.23.49 Max on Win 2K A> Does this version of MySQL supports subqueries. Nope. How to re-write queries read in our manual: http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html A> Also does this support transac

Re: Subqueries

2002-04-03 Thread Tyler Longren
It can't, try using JOIN. Tyler Longren Captain Jack Communications [EMAIL PROTECTED] www.captainjack.com - Original Message - From: "Leo Przybylski" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 03, 2002 1:35 PM Subject: Subqueries > Hello all, > > Does anyone kno

Re: Subqueries

2002-04-03 Thread Christopher Thompson
On Wednesday 03 April 2002 12:35 pm, Leo Przybylski wrote: > Hello all, > > Does anyone know if MySQL can do subqueries? Not the current version, no. > > I am trying to provide a SELECT subquery to an IN clause and I am getting > errors. Is this possible? Read the manual and follow the example

Re: subqueries?

2001-07-27 Thread Colin Faber
No that's a 4.1 TODO. Bryan Capitano wrote: > > Do any of the newer versions of MySQL support sub-queries yet? > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql

Re: subqueries / nested queries

2001-02-01 Thread Benjamin Pflugmann
Hi. For many sub-queries, there exists a one-query work-around. Most of the rest, you can work-around with some commands. And then, there are a few around which one has to work in application. There is a section in the manual about how to handle the lack of sub-queries, which explains the most