|
Posted by Dave on 07/12/05 14:20
frizzle (phpfrizzle@gmail.com) decided we needed to hear...
> Hi there
>
> I have a products site with a mysql backend.
> I have two tables:
> 1 with series,
> 1 with products belonging to certain series.
>
> Series looks like:
> - id
> - kind
> - active
> - name
>
> Products looks like:
> - id
> - series_id
> - name
>
> Since i'm kind of a newbie, i can't figure out the
> following:
> I need the query to get all product-information on products that are
> in a series where 'series.Active = 1' and 'series.kind = 543' (e.g.
> 543)
> Products have to be limited (e.g. 20)
> output sort of has to be:
>
> series.name - products.name - products.id
>
> I hope this is enough information.
>
> Thanks!
>
> Frizzle.
You pretty much defined the query yourself already...
select s.name, p.name, p.id
from series s, products p
where s.active = 1 and s.kind = 543 and s.id = p.series_id
order by s.name, p.name
limit 20
Remove/change the order by as required.
--
Dave <dave@REMOVEbundook.com>
(Remove REMOVE for email address)
[Back to original message]
|