|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this 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
|
|||
|
|||
|
I have 2 tables makes,products
makes ------- makeid primary name products ---------- prod_id primary key makeid model_no description RRP in the products i have set it so it refers to a make number in the make tables. How do i do a query so i can say display all products with a make ID of 5 etc.? ![]() name |
|
#2
|
|||
|
|||
|
You can do this:
Code:
SELECT * FROM products WHERE makeid = 5; Because your products table has the makeid reference, the 5 will be stored in that field. If you want to display all information, you can try this: Code:
SELECT * FROM products, names WHERE products.makeid = names.makeid; Try those queries, and you'll see the difference in the results.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
you can also use inner joins, which i think are a bit faster then normal joins.
PHP Code:
Always try to use inner joins as they are usually faster |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Simple Mysql Query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|