List:General Discussion« Previous MessageNext Message »
From:sheeri kritzer Date:February 8 2006 4:42pm
Subject:Re: query problem
View as plain text  
Hi Conor,

The table you showed us has 2 primary keys, which is not possible. 
Can you do a SHOW CREATE TABLE on *each* table?

-Sheeri

On 2/8/06, Conor McTernan <conormcternan@stripped> wrote:
> 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
>
>
Thread
query problemConor McTernan8 Feb
  • Re: query problemsheeri kritzer8 Feb
    • Re: query problemConor McTernan9 Feb
      • Re: query problemsheeri kritzer9 Feb
        • Re: query problemConor McTernan10 Feb