473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Query help needed

I've a table "article".
Any article is of a type in table "type1" or "type2"
Each type may be of a model in table "model1" or "model2".
Each model can be on a certain make, also in 2 tables, "make1" and "make2".

they are a few possibilities.
"article" can be of "type1" or "type2"
"type1" can be of "model1" only - "type2" can be of "model1" or "model2"
"model1" can be of "make1" only - "model2" can be of "make1" or "make2"

"article" has "type.id" field (char10). If it start with "my" then it's a
"type2", otherwise is a "type1"
"type1" has only "model1.id" field. "type2" has "model1" and "model2"
fields. If one is filled, the other isn't
"model1" has only "make1.id" field. "model2" has "make1.id" and "make2.id"
fields. If one is filled, the other isn't

so here are the possibilities:
article -> type1 -> model1 -> make1
article -> type2 -> model1 -> make1
article -> type2 -> model2 -> make1
article -> type2 -> model2 -> make2

Now, I must create the mysql query to get all fields given the "article.id".
Is it possible ?
How ???
will this work ? in pseudo-code

article left join type1 articleid = type1id
inner join model1 type1id = model1id //inner because if type1, the model is
1
inner join make1 model1id = make1id //inner because if model1, the make is 1
left join type2 articleid = type2id
left join model1 type2id = model1id
left join model2 type2id = model2id
left join make1 model2id = make1id
left join make2 model2id = make2id

Please help.

Bob
Jul 17 '05 #1
4 1323
On 2005-02-04, Bob Bedford <be******@YouKnowWhatToDoHerehotmail.com> wrote:
I've a table "article".
Any article is of a type in table "type1" or "type2"
Each type may be of a model in table "model1" or "model2".
Each model can be on a certain make, also in 2 tables, "make1" and "make2".


And how is that relevant in this group on PHP?
I think you are better of with a good
book/tutorial/insert-favorite-medium-here on (My)SQL.

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.info>
Jul 17 '05 #2
"Tim Van Wassenhove" <ti***@users.sourceforge.net> a écrit dans le message
de news: 36*************@individual.net...
On 2005-02-04, Bob Bedford <be******@YouKnowWhatToDoHerehotmail.com>
wrote:
I've a table "article".
Any article is of a type in table "type1" or "type2"
Each type may be of a model in table "model1" or "model2".
Each model can be on a certain make, also in 2 tables, "make1" and
"make2".


And how is that relevant in this group on PHP?
I think you are better of with a good
book/tutorial/insert-favorite-medium-here on (My)SQL.


since 90% of php programmers use mysql (I guess) and I've no access to mysql
newsgroups with my ISP, I've just tried, in the hope I'll still receive
valuable help as I did before in this NG for mysql questions.

Bob
Jul 17 '05 #3
On 2005-02-04, Bob Bedford <be******@YouKnowWhatToDoHerehotmail.com> wrote:
"Tim Van Wassenhove" <ti***@users.sourceforge.net> a écrit dans le message
de news: 36*************@individual.net...
On 2005-02-04, Bob Bedford <be******@YouKnowWhatToDoHerehotmail.com>
wrote:
I've a table "article".
Any article is of a type in table "type1" or "type2"
Each type may be of a model in table "model1" or "model2".
Each model can be on a certain make, also in 2 tables, "make1" and
"make2".


And how is that relevant in this group on PHP?
I think you are better of with a good
book/tutorial/insert-favorite-medium-here on (My)SQL.


since 90% of php programmers use mysql (I guess) and I've no access to mysql
newsgroups with my ISP, I've just tried, in the hope I'll still receive
valuable help as I did before in this NG for mysql questions.


Give them a fish, and they have food for 1 day.
Learn them how to fish, and they'll have food every day.

http://www.w3schools.com/sql/default.asp
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.info>
Jul 17 '05 #4
Tim Van Wassenhove wrote:
Give them a fish, and they have food for 1 day.
Learn them how to fish, and they'll have food every day.


Or as Simon & Garfunkel told Mrs Robinson, 'we'd like to
help you learn to help yourself'. Coo coo ca-choo.

Slainte!

--
Jock
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Irlan agous | last post by:
$query = "update reactie,form set 'reactie.persemail' = 'form.email' where 'reactie.persid' = 'form.id' AND reactie.persemail='' "; How can i get this query to work? Irlan
20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
6
by: paii | last post by:
I have a table that stores job milestone dates. The 2 milestones I am interested in are "Ship Date" TypeID 1 and "Revised Ship Date" TypeID 18. All jobs have TypeID 1 only some jobs have TypeID 18....
3
by: Eagle | last post by:
Hi all, This one's drivin' me nuts. Any help would be appreciated. (Access 2000). I have 3 tables: tblTools: having the basic data of a tool and a field (txt) showing yes or no with regard to...
3
by: cover | last post by:
I have a table with 50 fields that receive input depending on whether that input came in from a 'shaker' form or a 'conveyor' form. Input from the 'conveyor' form might populate 25 fields while...
3
by: faceman28208 | last post by:
Over the past few years I have consulted on six large projects that all independently arrived at the same moronic design desision: The use of SQL query classes. No, I don't mean a class...
0
by: Chuck36963 | last post by:
Hi all, I've been working on a listing problem and I can't figure out how to work it out. I have looked far and wide on the web to find answers, but I'd like other peoples input on my project in...
8
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
2
by: sara | last post by:
I am helping a non-profit track their elder clients and care given to the clients. The organization would like a report that shows various info on ALL clients, such as: # in each town, # and...
20
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.