mysql question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I've no access to mysql NG, so I ask here.

I've to get some datas from a database. The record struct is as follow:

make: makename, makeid
model: modelname, modelid, makeid
type: typename, typeid, modelid.

I'd like to get this view:

make1(make1 number)
    model1 (model1 number)
        type1 (type1 number)
        type2 ...
        type3 ...
    model2 (model2 number)

How to do this query ? Should I use Groupby ? how ?

Re: mysql question

*** Bob Bedford wrote/escribió (Mon, 9 May 2005 13:08:49 +0200):
Quoted text here. Click to load it


select .... from make
left join model on make.makeid=model.makeid
left join type on model.modelid=type.typeid

This should create:

make1 model1 type1
make1 model1 type2
make1 model1 type3
make1 model2 type4
make1 model2 type5

Then you can use control variables in PHP to replace repeated cells with

-- Álvaro G. Vicario - Burgos, Spain
-- - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group

Site Timeline