By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,406 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,406 IT Pros & Developers. It's quick & easy.

mysql question

P: n/a
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)
type4...
type5...
....

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

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
*** Bob Bedford wrote/escribió (Mon, 9 May 2005 13:08:49 +0200):
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)
type4...
type5...
....

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


Untested:

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
blanks.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.