Hello, I'm having a hell of a time figuring this query out, maybe someone can point me in the right direction.
I have a table which lists the case configurations for cases of items. Each case will have a different combination of sizes e.g. Case 002 has 2 size 5, 2 size 7 and 2 size 8 items. What I'm trying to do is, given a group of sizes and quantities how can I find the corresponding ID number for a case. Here's the description of the table. +---------------------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------+------------------+------+-----+---------+-------+ | CaseType_idCaseType | int(10) unsigned | NO | PRI | | | | Sizes_idsizes | int(10) unsigned | NO | PRI | | | | qty | int(10) unsigned | YES | | NULL | | +---------------------+------------------+------+-----+---------+-------+ Here's what I see if I do a select on a CaseType id. select * from CaseType_has_Sizes where CaseType_idCaseType = 61; +---------------------+---------------+------+ | CaseType_idCaseType | Sizes_idsizes | qty | +---------------------+---------------+------+ | 61 | 2 | 1 | | 61 | 4 | 1 | | 61 | 6 | 1 | | 61 | 8 | 1 | | 61 | 24 | 1 | | 61 | 26 | 1 | +---------------------+---------------+------+ I'm essentially trying to get the same resuts as this select, but in reverse.... I've tried using UNION but it doesnt seem to get what I'm trying for. Any help appreciated. Conor