I know table joins are supposed to be simple, and I’ve kinda sorta got a few of the simplest joins to work, but they’re extremely flawed. I’m not sure what I’m doing wrong, but 1) I think I picked up a bad habit somewhere along the line, and 2) it would be much more helpful if the examples in tutorials were put in context.
For example, this is cool…
SELECT * FROM a,b;
but where do you put it? Like this?SELECT * FROM a,b;
Or this?SELECT * FROM a,b;
And is it enclosed in something, like this?:
“SELECT * FROM a,b;”
It would help me tremendously if I had a working model, and it would be even better if it was a fairly complex join. I could then pick it apart to make variations and simpler joins. Accordingly, I’d like to ask if anyone would be willing to write the code for a join with the following specs:
First, I have two tables, named Continents and Nations, with five fields and four fields, respectively. Below are the names of the rows, with TWO entry examples (Africa and the Pacific Ocean) for each column.
NameC (Africa, Pacific Ocean)
TypeC (continent, ocean)
Group ( Old World, Oceanus)
Hemisphere (South, both)
CCode (caf, opa)
NameN (Kenya French Polynesia)
TypeN (nation, dependency)
NCode (ken, fp)
CCode (caf, opa)
CCode (abbreviations for continents and oceans) is designated the foreign key in Table Nations.
Now, suppose I want to to make a table that displays:
The first 3 columns from the table named “continents” (NameC, TypeC Group)
The first 3 columns from the table named “nations” (NameN, TypeN & NCode)
But only the rows that represent jurisdictions in Africa (CCode “caf”) and the Pacific Ocean (CCode “opa”) and…
Only the Pacific Ocean jurisdictions that are NATIONS (not dependencies, territories, or any other designation).
To put it another way, it will list all the African jurisdictions (all of which are nations) and all the Pacific Ocean NATIONS (nothing else), and it will list the first three columns from each table.
This is the connection information from the top of my page:
[php]<?php require_once('../../../Connections/World.php'); ?> <?php mysql_select_db($database_World, $World); [/php] If you're willing to tackle this, could you post the complete code, from the top of the page to ? I won't even show you what I've got, because I'd like to start with a blank slate and come up with the simplest formula. Thanks!