Hi,

I'm trying hard to figure out how to perform a special query in mysql 4.0.

I have one table "widgets" which has a column "widget-id" (int) and one
column "number_of_parts" (int).

And then I have another table "part_mapping" which has one column
"widget-id" (int) and one column "part_id" (int).

part_id is unique throughout the "part_mapping" table.

The idea is that every widget consists of several unique parts.

Now I want to select all widgets which are complete, this means where

SELECT COUNT(1) FROM `part_mapping` WHERE widget-id = ...  equals the
number_of_parts of "widget-id" in table widgets.

What I could do is simply "loop" over table "widgets" and execute a
select count for every wiget. This would result in a huge number if
queries needed form my client which is something I'd like to avoid.

I pretty much have no idea how I can do this without nested queries (and
to be frank not even how to do it with them) so I'd really appreciate
any help!

kind regards Philip

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to