Re: Make optimized LEFT JOIN with GROUP BY
Huh, in fact it is like that:
SELECT recepti.ID, recepti.ImeRecepta, recepti.Datum, receptislike.ID AS IDslike
FROM recepti
LEFT JOIN receptislike ON recepti.ID = receptislike.IDrecept
WHERE slovnica = 1 and validirano = 1 and datum < date() and jezik=1
GROUP BY recepti.ID
ORDER BY recepti.Datum DESC
Datum means date in my language :-)
Here is the explain:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE recepti ref recepti_multi recepti_multi 2 const 2974 Using where; Using temporary; Using filesort
1 SIMPLE receptislike ref receptislike_idx receptislike_idx 4 kulinarika.recepti.ID 1
Here is the recepti_multi index:
recepti_multi INDEX 5947 slovnica
Datum
jezik
Kategorija
Validirano
Subject
Views
Written By
Posted
13075
May 03, 2006 08:30AM
5525
May 03, 2006 09:11AM
Re: Make optimized LEFT JOIN with GROUP BY
4415
May 03, 2006 09:20AM
3996
May 03, 2006 09:21AM
6193
May 03, 2006 01:19PM
4302
May 03, 2006 02:38PM
2833
May 03, 2006 02:43PM
3858
May 03, 2006 03:35PM
3797
May 03, 2006 12:58PM
2709
May 03, 2006 01:17PM
2602
May 03, 2006 01:23PM
2503
May 03, 2006 04:03PM
2362
May 03, 2006 04:17PM
4524
May 03, 2006 04:29PM
2663
May 03, 2006 05:09PM
2691
May 03, 2006 05:45PM
2760
May 03, 2006 06:41PM
2559
May 04, 2006 06:05AM
4108
May 04, 2006 08:10AM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.