MySQL Forums
Forum List  »  Optimizer & Parser

Re: How to optimize an ORDER BY query using a range to avoid any filesorts
Posted by: sukh gill
Date: March 28, 2008 10:57PM

hi friends,

i have two queries

1. select * from table1 where pcat=101 order by catid;

2. select * from table2 where cat=catid order by id limit 1;


i want to join these two queries

i have already used its join queries

SELECT * FROM table2 ps inner join table pc on pc.catid=ps.cat where pcat=101 group by ps.title order by ps.id desc";


it returns not accurate ans. i want the latest entry if that title order by id but it gives me the first record of that particular title if i m using group by title.


what do i do if any suggestion please your most welcome
its urgent please reply me fast

thanks
sukh

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

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.