Temporary table vs. sub-select

2009-04-17 Thread Jerry Schwartz
`; Table `t3` won't have any indices, even if table `t2` does, is that correct? (Assume that the sub-select is really much more complicated that my example.) Wouldn't it be a lot faster to replace the sub-select with a temporary table that does have a key on `y`? Regards, Jerry Schwartz

Sub-SELECT

2004-05-14 Thread Andre MATOS
Hi list, does MySQL accept a SELECT inside another SELECT, like this: SELECT t.Trial_ID_Code AS Trial, CONCAT(s.Site_Primary_Investigator_Title, , s.Site_Primary_Investigator_Last_Name) AS 'Investigator', CONCAT(sc.Site_ID_Number, -, s.Site_ID_Code, -, sc.Scanner_ID_Number) AS Site,

Sub-select Inner Joins

2004-04-16 Thread zzapper
Hi Here's a complicated bit sql that I'm trying to Post from MSAccess to MySql I searched UseNet and read that in MySQL you cannot have a sub-select, but I'm lost as to how to split this into two selects? Any help gratefully received!!! SELECT distinct p.ProjectID ,p.ProjectName FROM

sub select equivalent

2003-12-12 Thread Dean A. Hoover
I am using version 3.23.58 and need to do the following: select * from a where id not in (select tbl_id from b where tbl=a); Given that my version does not support sub selects, how can I re-write the statement to get the desired results? Thanks. Dean Hoover -- MySQL General Mailing List For list

RE: sub select equivalent

2003-12-12 Thread Dan Greene
[mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: sub select equivalent I am using version 3.23.58 and need to do the following: select * from a where id not in (select tbl_id from b where tbl=a); Given that my version does not support sub

Re: sub select equivalent

2003-12-12 Thread Paul DuBois
At 14:03 -0500 12/12/03, Dean A. Hoover wrote: I am using version 3.23.58 and need to do the following: select * from a where id not in (select tbl_id from b where tbl=a); Given that my version does not support sub selects, how can I re-write the statement to get the desired results?

Re: sub select

2003-06-12 Thread Victoria Reznichenko
Mauro Andre Flores dos Santos [EMAIL PROTECTED] wrote: I've just downloaded the version 4.1. I tryed to run my first sub-select : SELECT curso.* FROM curso where curso.cdCurso IN (SELECT EstabMantemCurso.cdCurso FROM EstabMantemCurso) The following ERROR returned: [local] ERROR

sub select

2003-06-11 Thread Mauro Andre Flores dos Santos
Hi, I've just downloaded the version 4.1. I tryed to run my first sub-select : SELECT curso.* FROM curso where curso.cdCurso IN (SELECT EstabMantemCurso.cdCurso FROM EstabMantemCurso) The following ERROR returned: [local] ERROR 1235: This version of MySQL doesn't yet support 'LIMIT

How to select without using sub-select?

2003-06-06 Thread ola . billstein
Hi, I am running MySQL 4.0.10 gamma. I have records with data: id title version 1a 1 2a 2 3b 1 4b 2 How do I select all the records with highest version for each title? (The records with id 2 and 4) I've been thinking about combinating GROUP BY and

Re: How to select without using sub-select?

2003-06-06 Thread Nils Valentin
Hi Ola, How about SELECT id, title, max(version) FROM table GROUP BY version ORDER BY title; ? Thats a guess though... Best regards Nils Valentin Tokyo/Japan 2003 6 5 22:[EMAIL PROTECTED] : Hi, I am running MySQL 4.0.10 gamma. I have records with data: id title version 1a

Re: How to select without using sub-select?

2003-06-06 Thread gerald_clark
[EMAIL PROTECTED] wrote: Hi, I am running MySQL 4.0.10 gamma. I have records with data: id title version 1a 1 2a 2 3b 1 4b 2 How do I select all the records with highest version for each title? (The records with id 2 and 4) I've been thinking

Re: How to select without using sub-select?

2003-06-06 Thread Hans-Peter Grimm
[EMAIL PROTECTED] schrieb: I am running MySQL 4.0.10 gamma. I have records with data: id title version 1a 1 2a 2 3b 1 4b 2 How do I select all the records with highest version for each title? [...] Try: SELECT t1.id, t1.title, t1.version FROM

Re: How to select without using sub-select?

2003-06-06 Thread ola . billstein
Thanks everyone! Here is a working solution: (Normalizing the tables as O'K Web Design suggested is also a good design solution) Hans-Peter Grimm [EMAIL PROTECTED] [EMAIL PROTECTED] schrieb: I am running MySQL 4.0.10 gamma. I have records with data: id title version 1a 1 2

Update with sub-select from same table FAILS

2003-03-04 Thread smurf
Description: MySQL doesn't allow me to use a sub-select in an update if the subselect happens to be from the same table. How-To-Repeat: mysql use test; mysql create table T(lfd int, foo int); mysql insert into T (lfd, foo) values ( ( select max( lfd ) + 1

[ sub select in 4.0.9-gamma? ]

2003-02-13 Thread Elby Vaz
Hello friends! The MySQL-4.0.9-gamma to windows supports sub select? Ex.: select ... from ... where ... in (select.) If not, has some version that supports it? Thanks, e. _ MSN Hotmail, o maior webmail do Brasil

Re: [ sub select in 4.0.9-gamma? ]

2003-02-13 Thread Stefan Hinz
Elby, The MySQL-4.0.9-gamma to windows supports sub select? Nope. Subselect are supported as of 4.1. Regards, -- Stefan Hinz [EMAIL PROTECTED] iConnect GmbH http://iConnect.de Heesestr. 6, 12169 Berlin (Germany) Telefon: +49 30 7970948-0 Fax: +49 30 7970948-3

RE: [ sub select in 4.0.9-gamma? ]

2003-02-13 Thread Arthur Fuller
In the meantime, you can almost always perform the equivalent of a sub-select using an inner join (and sometimes a temp table). For example, a query to select all customers in the province of Ontario: SELECT * FROM Customers WHERE CityID IN( SELECT CityID FROM Cities WHERE ProvinceID = ON ) Can

re: [ sub select in 4.0.9-gamma? ]

2003-02-13 Thread Victoria Reznichenko
On Thursday 13 February 2003 15:03, Elby Vaz wrote: The MySQL-4.0.9-gamma to windows supports sub select? Nope. Ex.: select ... from ... where ... in (select.) If not, has some version that supports it? Subselects will come in 4.1 -- For technical support contracts, goto https

RE: sub select , distinct and mysql4

2003-01-27 Thread daniel
hi guys i was wondering if sub selects were possible in mysql 4 ? more specifically , whenever i do a join , i sometimes require a distinct select on the field in the first table and the second table may have many rows therefore returns the same value more than once from the first table which

Re: sub select

2003-01-09 Thread Jeremy Zawodny
On Wed, Jan 08, 2003 at 07:05:41PM -0800, Sal wrote: Hi, I'm using MySQL 4.0.7 gamma version. I just want to know if MySQL support sub select statement. The example of sub select statement is as below. I've tried many times but then get an error. No. They are in 4.1.0. -- Jeremy D

Re: sub select

2003-01-09 Thread Sal
Dear Jeremy, Thaks 4 ur info. Where can I get MySQL 4.1.0. regards, Sal --- Jeremy Zawodny [EMAIL PROTECTED] wrote: On Wed, Jan 08, 2003 at 07:05:41PM -0800, Sal wrote: Hi, I'm using MySQL 4.0.7 gamma version. I just want to know if MySQL support sub select statement. The example

re: Re: sub select

2003-01-09 Thread Egor Egorov
On Thursday 09 January 2003 09:32, Sal wrote: Thaks 4 ur info. Where can I get MySQL 4.1.0. You can compile it from development source tree: http://www.mysql.com/doc/en/Installing_source_tree.html -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This

sub select

2003-01-08 Thread Sal
Hi, I'm using MySQL 4.0.7 gamma version. I just want to know if MySQL support sub select statement. The example of sub select statement is as below. I've tried many times but then get an error. Example: select alc, fdate, sum(totalpax) from (select distinct alc, fln, fdate, totalpax from

Sub-Select query

2002-12-12 Thread Christos Vorkas
Dear all, I have the following query. When executed in MySQL I get an error on the first sub-select, and I can't find why: select slbc.stockcode, s.description, slp.qtyinstock, smax.pluqty, (slp.qtyinstock / smax.pluqty) from stocklevelbc slbc, stock s, stocklevel slp, stock smax

Re: Sub-Select query

2002-12-12 Thread David Bordas
I have the following query. When executed in MySQL I get an error on the first sub-select, and I can't find why: http://www.mysql.com/doc/en/News-4.1.x.html You'll see that sub-select query will be in future 4.1.xx release ... David

re: re: Delete from sub select

2002-12-06 Thread Victoria Reznichenko
Table2.ID IS NULL K because of MySQL ver 3.23.XX not support sub select while we still K use 3.23.XX In 3.23. you can't do it with single SQL statement. You can use programming language or use CONCAT() function as described here: http://www.mysql.com/doc/en/ANSI_diff_Sub-selects.html KW Yes I use

re: Delete from sub select

2002-12-05 Thread Kittiphum Worachat
that use to delete the record in Table1 that not found K in Table2 such as K Delete from Table1 where Table1.ID in K SELECT Table1.ID FROM Table1 LEFT JOIN Table2 Using(ID) K WHERE Table2.ID IS NULL K because of MySQL ver 3.23.XX not support sub select while we still K use 3.23.XX In 3.23. you

re: Delete from sub select

2002-12-04 Thread Victoria Reznichenko
in Table2 such as K Delete from Table1 where Table1.ID in K SELECT Table1.ID FROM Table1 LEFT JOIN Table2 Using(ID) K WHERE Table2.ID IS NULL K because of MySQL ver 3.23.XX not support sub select while we still K use 3.23.XX In 3.23. you can't do it with single SQL statement. You can use programming

Delete from sub select

2002-12-03 Thread Kittiphum
.ID FROM Table1 LEFT JOIN Table2 Using(ID) WHERE Table2.ID IS NULL because of MySQL ver 3.23.XX not support sub select while we still use 3.23.XX and one more question How to merge table with varchar type not char type (because if table contain varchar column we can't merge them but with table

(OT) Re: Bill, your computer has got a worm (virus-like thingie) Re: Sub-select look-alike?

2002-10-16 Thread DL Neil
-like thingie) Re: Sub-select look-alike? Hi Bill, you wrote to me and probably several other people: If I understand your question, you just need to join with the languages table twice, using aliases: select LF.language, LT.language from language_pairs P, languages LF, languages

sub-select workaround

2002-09-30 Thread joseph speigle
= location.location; (the foreign key reference is on a third table, the category table, but I can only get there through the location table, the one with the nulls) it would seem to call for some kind of array/loop insert, how can I do that without using a sub-select? i can't do a insert

Sub-select look-alike?

2002-03-13 Thread Andreas Frøsting
Hi, I have two tables: languages: id tinyint(3) unsigned not null, language varchar(30) not null language_pairs: from tinyint(3) unsigned not null, to tinyint(3) unsigned not null language_pairs.from and language_pairs.to are linked with

RE: Sub-select look-alike?

2002-03-13 Thread Johnson, Gregert
: Sub-select look-alike? Hi, I have two tables: languages: id tinyint(3) unsigned not null, language varchar(30) not null language_pairs: from tinyint(3) unsigned not null, to tinyint(3) unsigned not null language_pairs.from and language_pairs.to

RE: Sub-select look-alike?

2002-03-13 Thread Yana
13, 2002 10:13 AM To: [EMAIL PROTECTED] Subject: Sub-select look-alike? Hi, I have two tables: languages: id tinyint(3) unsigned not null, language varchar(30) not null language_pairs: from tinyint(3) unsigned not null, to tinyint(3) unsigned not null

RE: Sub-select look-alike?

2002-03-13 Thread Andreas Frøsting
Hi Greg, SELECT f.language as From, t.language as To FROM language f, language t, language_pairs lp WHERE f.id = lp.from AND t.id = lp.to; I really need to get some sleep I think. So simple, and yet my buggy mind didn't come up with that solution. Thanks, //andreas (sql, query - just to

Re: Sub-select look-alike?

2002-03-13 Thread Bill Easton
] To: [EMAIL PROTECTED] Subject: Sub-select look-alike? Date: Wed, 13 Mar 2002 16:12:31 +0100 Hi, I have two tables: languages: id tinyint(3) unsigned not null, language varchar(30) not null language_pairs: from tinyint(3) unsigned not null

Re: insert into with sub select

2002-02-27 Thread Rob
the select returns. The restriction is less relevant if you are performing a select which can return at most one row, but mySQL still enforces it. There are a couple of solutions to this. The cleanest one is probably just to use temporary tables to implement a true sub-select. (I've put together

Re: insert into with sub select

2002-02-27 Thread Sommai Fongnamthip
enforces it. There are a couple of solutions to this. The cleanest one is probably just to use temporary tables to implement a true sub-select. (I've put together a framework to do this hidden behind an abstraction layer so that I can do subselects whether I'm using mySQL or a different database

Re: insert into with sub select

2002-02-27 Thread Sommai Fongnamthip
enforces it. There are a couple of solutions to this. The cleanest one is probably just to use temporary tables to implement a true sub-select. (I've put together a framework to do this hidden behind an abstraction layer so that I can do subselects whether I'm using mySQL or a different database

insert into with sub select

2002-02-26 Thread Sommai Fongnamthip
Hi, MySQL has insert into function and sub select (mysql style) but I could not conclude these function togethter. If I want to select not existing row in 2 table, I used: SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id where table2.id is null

Re: insert into with sub select

2002-02-26 Thread Paul DuBois
At 9:18 +0700 2/27/02, Sommai Fongnamthip wrote: Hi, MySQL has insert into function and sub select (mysql style) but I could not conclude these function togethter. If I want to select not existing row in 2 table, I used: SELECT table1.* FROM table1 LEFT JOIN table2

Re: insert into with sub select

2002-02-26 Thread Sommai Fongnamthip
I was successful to get result from select (this sub-select appear in MySQL manual). At 21:20 26/2/2002 -0600, Paul DuBois wrote: At 9:18 +0700 2/27/02, Sommai Fongnamthip wrote: Hi, MySQL has insert into function and sub select (mysql style) but I could not conclude these function

sub select

2002-01-24 Thread Sommai Fongnamthip
Hi, I know sub select would not work correct in 3.23.xx but I have a question to ask. I'd like to find top 10 ranking of my customer by amount (using order clause desc) but there are some customer have the same amount. I was solve this problem by using group by and insert

SUB-SELECT

2001-11-15 Thread Lyubomir Simich
Hello Can I make a query in mySQL like this? DELETE FROM table1 WHERE id NOT EXIST IN (SELECT id FROM table2) -- WBR Lyubomir mailto:[EMAIL PROTECTED] - Before posting, please

RE: SUB-SELECT

2001-11-15 Thread Rick Emery
no -Original Message- From: Lyubomir Simich [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 12:04 PM To: [EMAIL PROTECTED] Subject: SUB-SELECT Importance: High Hello Can I make a query in mySQL like this? DELETE FROM table1 WHERE id NOT EXIST IN (SELECT

SUB-SELECT

2001-11-15 Thread Christopher Book
You can'd use sub-selects... you have to do it with a join. Chris Can I make a query in mySQL like this? DELETE FROM table1 WHERE id NOT EXIST IN (SELECT id FROM table2) - Before posting, please check:

RE: SUB-SELECT

2001-11-15 Thread Christopher Book
they will be in mysql 4.1 -Original Message- From: Rosyna [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 2:11 PM To: Christopher Book; '[EMAIL PROTECTED]' Subject: Re: SUB-SELECT Anyone know if subselects will be available in the future? Ack, at 11/15/01, Christopher

RE: how to sub-select?..

2001-10-22 Thread Moshe Gurvich
so what's the remedy? how to do this task in MySQL without using subselects? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Trond Eivind Glomsrød Sent: Monday, October 22, 2001 1:13 PM To: Moshe Gurvich Cc: [EMAIL PROTECTED] Subject: Re: how to sub

Re: how to sub-select?..

2001-10-22 Thread Mark Maunder
Trond Eivind Glomsrød wrote: Moshe Gurvich [EMAIL PROTECTED] writes: I'm trying to run: delete from followups where task_id not in (select task_id from tasks) but it gives me an error: Error: 1064 - You have an error in your SQL syntax near 'select task_id from tasks)' at line 1

Re: how to sub-select?..

2001-10-22 Thread Sergei Golubchik
Hi! On Oct 22, Moshe Gurvich wrote: so what's the remedy? how to do this task in MySQL without using subselects? delete from followups where task_id not in (select task_id from tasks) Multi-table deletes (MySQL 4.0.0+) DELETE followups FROM followups LEFT JOIN tasks USING(task_id)

RE: how to sub-select?..

2001-10-22 Thread Moshe Gurvich
:) -Original Message- From: Sergei Golubchik [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 1:57 PM To: Moshe Gurvich Cc: [EMAIL PROTECTED] Subject: Re: how to sub-select?.. Hi! On Oct 22, Moshe Gurvich wrote: so what's the remedy? how to do this task in MySQL without using

Re: how to sub-select?..

2001-10-22 Thread Sergei Golubchik
Hi! On Oct 22, Moshe Gurvich wrote: thank you very much; i'm using right now v3.23 as recommended for production servers, but anyway.. now, using the way you suggested, will this work: DELETE FROM tasks FROM tasks as t_child LEFT JOIN tasks as t_parent ON

RE: how to sub-select?..

2001-10-22 Thread Moshe Gurvich
in JOIN structure? -Original Message- From: Sergei Golubchik [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 3:01 PM To: Moshe Gurvich Cc: [EMAIL PROTECTED] Subject: Re: how to sub-select?.. Hi! On Oct 22, Moshe Gurvich wrote: thank you very much; i'm using right now v3.23

Re: how to sub-select?..

2001-10-22 Thread Sergei Golubchik
Hi! On Oct 22, Moshe Gurvich wrote: yeah, noticed it after clicked send.. let's say i upgrade to MySQL 4.0 and run this query: DELETE FROM tasks as t_child LEFT JOIN tasks as t_parent ON t_child.parent_id=t_parent.task_id WHERE t_parent.task_id IS NULL will this work? no.

RE: how to sub-select?..

2001-10-22 Thread Moshe Gurvich
=t_parent.task_id WHERE t_parent.task_id IS NULL -Original Message- From: Sergei Golubchik [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 3:52 PM To: Moshe Gurvich Cc: [EMAIL PROTECTED] Subject: Re: how to sub-select?.. Hi! On Oct 22, Moshe Gurvich wrote: yeah, noticed it after

Re: Sub select.

2001-08-08 Thread Tonu Samuel
On 07 Aug 2001 10:46:31 -0400, Trond Eivind Glomsrød wrote: MySQL doesn't have subselects. Some workarounds can be found at http://www.mysql.com/documentation/mysql/bychapter/manual_Introduction.html#Missing_Sub-selects PostgreSQL supports them. Actually MySQL 4.0 will do. -- For

Re: Sub select.

2001-08-07 Thread Anders Alstrin
Den 01-08-07 14.57, skrev Anders Alstrin [EMAIL PROTECTED]: Does anyone know how to do this sub select in MySQL. I know how to do it in Oracle! table media +--+---+--+ | media_id | price |filename | +--+---+--+ |3 | 0 | cal.jpg

Re: Sub select.

2001-08-07 Thread Tyler Longren
I don't think MySQL supports sub selects. Tyler On Tue, 07 Aug 2001 14:57:33 +0200 Anders Alstrin [EMAIL PROTECTED] wrote: Does anyone know how to do this sub select in MySQL. I know how to do it in Oracle! table media +--+---+--+ | media_id | price |filename

RE: Sub select.

2001-08-07 Thread Remco Brood
= 'true' -Original Message- From: Anders Alstrin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 2:58 PM To: [EMAIL PROTECTED] Subject: Sub select. Does anyone know how to do this sub select in MySQL. I know how to do it in Oracle! table media

Re: Sub select.

2001-08-07 Thread Trond Eivind Glomsrød
Anders Alstrin [EMAIL PROTECTED] writes: Does anyone know how to do this sub select in MySQL. MySQL doesn't have subselects. Some workarounds can be found at http://www.mysql.com/documentation/mysql/bychapter/manual_Introduction.html#Missing_Sub-selects PostgreSQL supports them. -- Trond

Re: Sub select.

2001-08-07 Thread Tonu Samuel
On 07 Aug 2001 14:57:33 +0200, Anders Alstrin wrote: SELECT * FROM media WHERE media_id = (SELECT media_id FROM category_locks WHERE category_id = (SELECT category_id FROM categories WHERE dynamic_media = 'true')) A MySQL way to do it? Something like that should work: SELECT * FROM

RE: Sub select.

2001-08-07 Thread Sam Masiello
:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 9:58 AM To: Anders Alstrin Cc: [EMAIL PROTECTED] Subject:Re: Sub select. I don't think MySQL supports sub selects. Tyler On Tue, 07 Aug 2001 14:57:33 +0200 Anders Alstrin [EMAIL PROTECTED] wrote: Does anyone know how to do

Re: Sub select.

2001-08-07 Thread Stefan Hinz
# Gustav-Meyer-Allee 25, 13355 Berlin # Tel: +49-30-46307-382 Fax: +49-30-46307-388 - Original Message - From: Anders Alstrin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 07, 2001 2:57 PM Subject: Sub select. Does anyone know how to do this sub select in MySQL. I know