I am creating a web site that uses 6 tables from one database in mysql (example)
2 sets of tables that connect to intermediate tables (using foreign keys to join the tables).
1) Category -> Cat2Links <- Links
2) Staff -> S2Phone <- Phones
I need help querying through each tables to produce a result from links and phones in one search query.
1st set 2nd set
|------------------| |-----------------------|
| Category | | Staff |
|------------------| |-----------------------|
| id int | | id int |
| name varchar(200)| | firstname varchar(50) |
|------------------| | lastname varchar(75) |
| | title varchar(100) |
o |-----------------------|
|------------------| |
| Cat2Links | o
|------------------| |-----------------------|
| category int | | S2Phone |
| links int | |-----------------------|
|------------------| | staff int |
o | phones int |
| |-----------------------|
|-----------------------| o
| Links | |
|-----------------------| |-----------------------|
| id int | | Phones |
| name varchar(200) | |-----------------------|
| anchor varchar(200) | | id |
| keywords varchar(200) | | desk varchar(12) |
|-----------------------| | wireless varchar(12) |
\ | mobile varchar(12) |
\ | oncall varchar(12) |
\ | keywords varchar(52) |
\------ |-----------------------|
\ |
|-------------------------------------------------------------|
| Results would be from links (keywords) and phones (keywords)|
|-------------------------------------------------------------|
Would this be the right way to engineer this project?
Aucun commentaire:
Enregistrer un commentaire