tags:

views:

176

answers:

1

Hi,

i have a master table page, and a relative table page_lang.In page_lang i hold the page data for each language.

Using the the above code

SELECT * FROM pages as p
RIGHT JOIN pages_lang as l ON
l.pageID=p.pageID

i get the rows containing common data form pages and language data from page_lang.All OK

The problem is when rty to limit the results

SELECT * FROM pages as p
RIGHT JOIN pages_lang as l ON
l.pageID=p.pageID
LIMIT 0,10

Using this query i was expecting to select the first 10 row of page and for those then rows return the language data. For example if i have 2 languages mean return 10 rows x 2 languages 20 rows.

Of course the query does not return 20 rows but only 10 .

I am looking how ro do this using 1 query because i am trying to count the queries on each page to be faster.

Thanks

+1  A: 

This might work (untested):

SELECT * 
FROM 
    (SELECT * FROM pages LIMIT 0,10) p
    RIGHT JOIN 
    pages_lang as l 
ON l.pageID = p.pageID;
Bryan Menard
Its working yes. BUT using 2 SELECT is one query for mysql or is 2 queries
ntan
but not very well i will try to tune it
ntan
2 SELECTs is still one query.
Jeremy Stein