table join

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone

I'm having a whole lot of fun playing with this project. It just keeps 
expanding and taking me to new territory and I'm really enjoying it. I got a 
quick question though. I've been playing around with table joins and I tried 
to join based on the ID but I quickly realized this is not a good solutions, 
because the ID's in each table aren't always going to match. This is a simple 
join that I was messing around with:

$sql = 'SELECT * FROM inventory, extended_info WHERE inventory.id =
extended_info.id';

So I'm wondering if I should figure a way to always make my ID's in each table 
match, which is probably not possible or I'm thinking a unique field for both 
tables and use that to match up the records, but I know zilch about cars 
(funny considering what I chose to start with) and I couldn't think of 1 thing 
that would be unique to match up... LOL so what would be a wise way to go 
about this type of thing.

PS I'm not looking for code, just some feedback on logic.
-- 
Regards
David M.

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux