LIMIT in a subselect, but without using subselects
- From: "MrKrinkle" <yugyug66@xxxxxxxxxxx>
- Date: 18 Jul 2005 13:51:22 -0700
I'm using mysql v 4.0.something (so no subselects :( )
I have a table of shoppingcarts, and a table of cartitems. cartitems
have the cartuid of the shoppingcart they're in. Pretty simple, right?
if I do:
SELECT * from shoppingcarts left join cartitems on cartitems.cartuid=
shoppingcarts.uid LIMIT 50,10;
The LIMIT clause will be limiting the number of "rows" I get back in
the results (of course). What I *want* it to limit is the number of
"shoppingcarts" I get back. So I can make a tool that shows 10
shopping carts (with items in them) per page.
If I could do subselects, this is what the query would look like:
select * from shoppingcarts left join cartitems on cartitems.cartuid=
shoppingcarts.uid where shoppingcarts.uid in (select uid from
shoppingcarts order by created desc LIMIT 50,10);
(obviously that's untested since I can't do subselects on my mysql).
How can I do that with a left join instead? thanks
.
- Follow-Ups:
- Re: LIMIT in a subselect, but without using subselects
- From: Ed Prochak
- Re: LIMIT in a subselect, but without using subselects
- From: Bill Karwin
- Re: LIMIT in a subselect, but without using subselects
- Prev by Date: Re: MS Access IT Studies
- Next by Date: Dont miss Extreme Markup Languages 2005 -- Two Weeks Away
- Previous by thread: Requesting advise for design strategy
- Next by thread: Re: LIMIT in a subselect, but without using subselects
- Index(es):
Relevant Pages
|