Re: Correlated subquery help

2004-12-01 Thread Dan Sashko
isn't the where subquery would always return only one record if set of (k1,k2) is a primary key? I dont have 4.1+ installed to test on but if you remove 'limit 10' and run it don't you get the same list as if you ran 'select k1,k2,total_amt from Z' ? - Original Message - From: Rick

A Select improvement

2004-11-30 Thread Dan Sashko
Hi, anyone has suggestions what changes to make to allow this query to run faster? SELECT domain FROM tbl_1 WHERE id 0 and id 2 domain = 12.221.190.111 AND score IS NOT Null AND data LIKE %param=search GROUP BY domain, data -- every one of those WHERE clauses makes the query very

Re: help with SQL (join?) query

2004-11-30 Thread Dan Sashko
I think he gave you the right answer. you can also use joins instead of where, but it is the same idea, not sure which one of the two will be faster though: select groupid, groupname, owner.name as f_owner, creator.name as f_creator from groups left join users as owner on owner.uid =

SELECT on string

2004-11-10 Thread Dan Sashko
hi i have a recordset of about 4 mil records, SELECT * from rec where string_field=somestring takes very long time (30+ sec). string_field is indexed MUL. Is there way to make it faster?

Re: SELECT on string

2004-11-10 Thread Dan Sashko
about minute and a half. - Original Message - From: Michael Stassen [EMAIL PROTECTED] To: Dan Sashko [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 6:01 PM Subject: Re: SELECT on string What does EXPLAIN SELECT * from rec where string_field='somestring'; say

SELECT where String

2004-11-05 Thread Dan Sashko
hello, I've a query that runs very slow: select name, count(id) where str_field = some string or (str_field string with nuber at end 1 and str_field string with nuber at end 9) group by name i have about 4mil records and the query takes about 3 minutes str_field, name are MUL indexes both

Re: Slow ORDER BY query..

2004-10-25 Thread Dan Sashko
from mysql: With EXPLAIN SELECT ... ORDER BY, you can check whether MySQL can use indexes to resolve the query. It cannot if you see Using filesort in the Extra column. . further : In MySQL 4.1 and up, a filesort optimization is used that records not only the sort key value and row

SELECT earliest unique records

2004-10-12 Thread Dan Sashko
I have a table that contains a item_id field (non unique index) id field and a date field. How would you go about selecting rows from the table (single row for each item_id with the earliest date field for that item_id). If I use group by item_id the date field will be whatever the first date

Re: SELECT earliest unique records

2004-10-12 Thread Dan Sashko
thank you, this does return the proper date field for the item_id, however the rest of the fields of the records are still from the first record in the table. How would you make it so that the entire row is the one that contains the earliest data field ? - Original Message - From:

Copy a record

2004-09-10 Thread Dan Sashko
hi, a quick question. is there a way to duplicate a record (without knowing fields in advance) in sql alone? the only thing is know is that `id` is a primary key (autonumber) something of this sort: INSERT INTO the_table SELECT * FROM the_table WHERE id=the_number this fails due duplicate