RE: Use of limit with IN on subquery

2004-12-04 Thread Rick Robinson
: [EMAIL PROTECTED]Cc: Michael Stassen; 'Mysql'; Roger BaklundSubject: Re: Use of limit with IN on subquery What if we used the MySQL-specific feature "group-wise auto_increment" ? http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html For MyISAM and BDB tables you can specify AUTO

Use of limit with IN on subquery

2004-12-03 Thread Rick Robinson
Hi all- I'm using MySQL 4.1.7, trying to do a subquery that's apparently unsupported - I'm hoping someone can provide a quick alternative for me. I have a simple table Z with 3 columns, k1, k2, and total_amt, where k1 and k2 make up the primary key. I want to create a report that lists the the

Re: Use of limit with IN on subquery

2004-12-03 Thread Roger Baklund
Rick Robinson wrote: Hi all- I'm using MySQL 4.1.7, trying to do a subquery that's apparently unsupported - I'm hoping someone can provide a quick alternative for me. I have a simple table Z with 3 columns, k1, k2, and total_amt, where k1 and k2 make up the primary key. I want to create a

Re: Use of limit with IN on subquery

2004-12-03 Thread Roger Baklund
Rick Robinson wrote: I'm using MySQL 4.1.7, trying to do a subquery that's apparently unsupported - I'm hoping someone can provide a quick alternative for me. I have a simple table Z with 3 columns, k1, k2, and total_amt, where k1 and k2 make up the primary key. I want to create a report that

RE: Use of limit with IN on subquery

2004-12-03 Thread Rick Robinson
-Original Message- From: Roger Baklund [mailto:[EMAIL PROTECTED] Sent: Friday, December 03, 2004 10:32 AM To: Mysql Cc: [EMAIL PROTECTED] Subject: Re: Use of limit with IN on subquery Rick Robinson wrote: Hi all- I'm using MySQL 4.1.7, trying to do a subquery that's apparently unsupported

RE: Use of limit with IN on subquery

2004-12-03 Thread Rick Robinson
have a table with about 500,000 rows (not really too big), so I'm hopeful. Thanks again. Best regards, Rick -Original Message- From: Roger Baklund [mailto:[EMAIL PROTECTED] Sent: Friday, December 03, 2004 10:49 AM To: Mysql Cc: [EMAIL PROTECTED] Subject: Re: Use of limit

Re: Use of limit with IN on subquery

2004-12-03 Thread Michael Stassen
: [EMAIL PROTECTED] Subject: Re: Use of limit with IN on subquery Rick Robinson wrote: I'm using MySQL 4.1.7, trying to do a subquery that's apparently unsupported - I'm hoping someone can provide a quick alternative for me. I have a simple table Z with 3 columns, k1, k2, and total_amt, where k1 and k2

Re: Use of limit with IN on subquery

2004-12-03 Thread Michael Stassen
Michael Stassen wrote: Don't bother. This is a very expensive solution. You get nearly a Cartesian product on each JOIN. I've got a 40 row test table with 20 values in each of 2 groups. The top 3 version of this examines 2302 rows to produce the 3 values for each of the 2 groups. The top

Re: Use of limit with IN on subquery

2004-12-03 Thread Michael Stassen
I think Roger was actually on the right track with his initial suggestion that this is a groupwise maximum problem as described in the manual page he referenced. Try this: CREATE TEMPORARY TABLE topten (k1 CHAR(1), total_amt int); LOCK TABLES Z AS x READ, Z AS y READ; INSERT INTO topten

RE: Use of limit with IN on subquery

2004-12-03 Thread emierzwa
where b.k1=a.k1 and b.total_amt=a.total_amt) Ed -Original Message- From: Rick Robinson [mailto:[EMAIL PROTECTED] Sent: Friday, December 03, 2004 9:14 AM To: 'Roger Baklund'; 'Mysql' Subject: RE: Use of limit with IN on subquery Hi Roger- Thanks for responding so quickly

Re: Use of limit with IN on subquery

2004-12-03 Thread Roger Baklund
Michael Stassen wrote: Michael Stassen wrote: Don't bother. This is a very expensive solution. You get nearly a Cartesian product on each JOIN. I've got a 40 row test table with 20 values in each of 2 groups. The top 3 version of this examines 2302 rows to produce the 3 values for each of

Re: Use of limit with IN on subquery

2004-12-03 Thread SGreen
What if we used the MySQL-specific feature group-wise auto_increment ? http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html For MyISAM and BDB tables you can specify AUTO_INCREMENT on a secondary column in a multiple-column index. In this case, the generated value for the

Re: Use of limit with IN on subquery

2004-12-03 Thread Roger Baklund
[EMAIL PROTECTED] wrote: What if we used the MySQL-specific feature group-wise auto_increment ? I was thinking of a similar idea, with user variables, also MySQL-specific. What do y'all think? I think it should work, but only Rick can tell... :) -- Roger -- MySQL General Mailing List For list