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
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
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 =
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?
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
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
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
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
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:
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
10 matches
Mail list logo