Hi dn, thanks for replying. I suspect you're right about my 'problem' - I'm probably misunderstanding some simple SQL construct :-)
Let's say I have the following tables: parts (partid int, partname varchar(255)) cats (catid int, catname varchar(255)) parts_cats (id int, partid int, catid int) To track which categories are assigned to which parts. I can use the following query to return parts and associated categories: SELECT partid,catid,partname,catname FROM parts_cats LEFT JOIN parts ON parts_cats.partid=parts.partid LEFT JOIN cats ON parts_cats.catid=cats.catid However, as I won't know how many categories are assigned to a given part, how can I: a) Form a query that only returns a list of parts that match a specifc set of categories (i.e. parts_cats has records where catid=1, 3 and 7 for any given partid) b) Know how many unique records I'm dealing with. Using the SQL above, if a part has, say, 3 categories then 3 rows would be returned. 4 categories and 4 rows are returned, etc. - how can I tell how big my result set is so that I can page through it using LIMIT? Hope I've explained myself clearly! - thanks in advance, james ps Completely OT question - how do you find your HomeChoice service? Been thinking about getting it for a while. j. At 09:39 10/02/2002 +0000, you wrote: >The separate table idea is standard relational theory. The tbl schema >might involve (1) a unique Id column (with >AUTO_INCREMENT), (2) a 'copy' of whatever data from the existing tbl(s) to >sufficiently identify the particular >response/select box, and (3) one of the select box return values - there >would then be as many rows as there >were responses in the select box (n=3 in this example). The second of >these must be sufficient information to >uniquely identify which table entry in the original "table" relates to the >particular select-response - these >are called Foreign Keys. > >To retrieve all of the select-responses, you would indeed issue a >SELECT...JOIN and thus be able to reassemble >the HTML select command, for example. > >Yes you are correct (in your example) such a SELECT will produce a >resultset of 3 rows. This will allow you to >search on a single, or multiple (concurrent) select-responses. > >As mentioned, this is SOP. You say you want multiple responses but not >multiple "entries", but not why. Perhaps >most of the 'problem' lies hidden there? >=dn > > > >--------------------------------------------------------------------- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail ><[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php James Carrier Bullet Online :: Aim Higher [http://www.bulletonline.com] 41b Beavor Lane, London W6 9BL Tel +44 (0) 20 8834 3442 Fax +44 (0) 20 8741 2790 --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php