List:General Discussion« Previous MessageNext Message »
From:David Bruha Date:March 19 1999 2:46pm
Subject:SQL Problem
View as plain text  
First of all, I would like to thank you for your quick response to my
previous question. It has helped me a tot.

Now I have another problem. I have created these three tables in my
database:

CREATE TABLE products (
  prod_ID int(11),
  prod_name varchar(60)
);

CREATE TABLE accessories (
  acc_ID int(11),
  acc_name varchar(60),
  comment blob
);

CREATE TABLE acc_to_prod (
  accessoryID int(11),
  productID int(11),
  serial tinyint(1) DEFAULT '0'
);

I have to create table in the output, where the columns are products and
rows are accesories:
 - in the first column should be put names of all relevant accessories,
 - in the second column should be put bullet if tis accessory belongs to
the first product (if not, leave it blank),
 - in the third column should be put bullet if tis accessory belongs to
the second product,
 - and so on ... there could be one to ten products displayed together.


I know how to do this with nested selects but I must admit that without
it I'm at a loss. Of course that I can do it with a cycle but isn't
there a way to do it directly with mysql?

Could anybody of you help me?

-david- 

------------------------------------------------------------------------
| David Bruha                                                          |
| David.Bruha@stripped					       |
| David.Bruha@stripped                                                |
| http://sorry.vse.cz/~xbrud03/                                        |
------------------------------------------------------------------------
Thread
SQL ProblemDavid Bruha19 Mar
  • Re: EXPORTING DATA: OK, this might be a bit general but..Erik Gillespie20 Jun