|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi,
i have a little search engine running. Its one table, i have a couple categories. I realized the categories with simply one field called categorie so i can show all the data in a single categorie by selecting it with the query SELECT * FROM table WHERE categorie = 'categoriename'. This works quite fine. But now i read my new book. Its MySQL and mSQL by OReilly. Its a very great book. According to their database design chapter its better if i would create one table for each categorie. That would be no problem but: How am I gonna search more then one table with one query? Some say I can do this with Joins but i dont know how. Can somebody help me?? |
|
#2
|
|||
|
|||
|
I haven't tested the follow code but i think that it work!
The query you search: $query = "SELECT t1.*,t2.*,t3.* FROM table1 as t1, table2 as t2, table3 as t3 WHERE t1.categorie='categoriename' or t2.categorie='categoriename' or t3.categorie='categoriename'"; Please tellme if this statement works! Thanx! |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Search a couple tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|