473,218 Members | 1,892 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,218 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 1316
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: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.