Query Help
am 10.07.2010 02:37:41 von phillip
--000325574d562a63a2048afdba55
Content-Type: text/plain; charset=ISO-8859-1
Hello All,
For the life of me I cannot remember how to make a query like this and what
it is called.
I know it is fairly basic though.
Table 1
Product_id Product_Name
Table 2
Category_id, Category_name
Table 3
Product_id, Category_id
Each product can have one or more categories.
So I want a result that has
Product A one category other category
Product B other category
Thanks in advance.
Blessed Be
Phillip
If you try to protect idiots from themselves, even if you succeed, you just
wind up filling the world with idiots.
- - Doug Casey
--000325574d562a63a2048afdba55--
Re: Query Help
am 10.07.2010 05:43:19 von Michael Satterwhite
I believe you're describing a crosstab query. This should help you put it
together:
http://rpbouman.blogspot.com/2005/10/creating-crosstabs-in-m ysql.html
---Michael
On Friday, July 09, 2010 07:37:41 pm Phillip Baker wrote:
> Hello All,
>
>
> For the life of me I cannot remember how to make a query like this and what
> it is called.
> I know it is fairly basic though.
>
>
> Table 1
> Product_id Product_Name
>
> Table 2
> Category_id, Category_name
>
> Table 3
> Product_id, Category_id
>
> Each product can have one or more categories.
> So I want a result that has
>
> Product A one category other category
> Product B other category
>
> Thanks in advance.
>
> Blessed Be
>
> Phillip
>
> If you try to protect idiots from themselves, even if you succeed, you just
> wind up filling the world with idiots.
> - - Doug Casey
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: Query Help
am 12.07.2010 13:27:24 von Jay Blanchard
[snip]
For the life of me I cannot remember how to make a query like this and
what
it is called.
I know it is fairly basic though.
Table 1
Product_id Product_Name
Table 2
Category_id, Category_name
Table 3
Product_id, Category_id
Each product can have one or more categories.
So I want a result that has
Product A one category other category
Product B other category
[/snip]
Can you give us an example of how you would like the output to be?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: Query Help
am 12.07.2010 18:24:08 von phillip
--000e0cd39cb6a08f7f048b332ef0
Content-Type: text/plain; charset=ISO-8859-1
Table 1
Product_id | Product_Name
1 | Product A
2 | Product B
3 | Product C
Table 2
Category_id | Category_Name
1 | Admin
2 | Marketing
3 | Support
4 | IT
Table 3
Product_id | Category_id
1 | 1
1 | 3
2 | 2
3 | 3
3 | 4
Result would look like
Product A, Admin, Support
Product B, Marketing
Product C, Support, IT
I believe this is a one to many using an index table?
Blessed Be
Phillip
If you try to protect idiots from themselves, even if you succeed, you just
wind up filling the world with idiots.
- - Doug Casey
On Mon, Jul 12, 2010 at 5:27 AM, Jay Blanchard wrote:
> [snip]
> For the life of me I cannot remember how to make a query like this and
> what
> it is called.
> I know it is fairly basic though.
>
>
> Table 1
> Product_id Product_Name
>
> Table 2
> Category_id, Category_name
>
> Table 3
> Product_id, Category_id
>
> Each product can have one or more categories.
> So I want a result that has
>
> Product A one category other category
> Product B other category
> [/snip]
>
> Can you give us an example of how you would like the output to be?
>
--000e0cd39cb6a08f7f048b332ef0--