joints - extracting common results from comparing 2 tables

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

 



Good afternoon,

i haven't done much with php and Mysql the past 2 years so my knowledge is
not really up-to-date.

i'm not a hero when it comes to math. actually, it's a weakness but trying
to fix that.

i made a query where i compare 2 tables against eachother and then i want
to see a table that shows me results: the Relation + Surname should match.

i have chosen for those two because Surname was a required input and all
contacts must have a relation. also, in those tables there are fields that
have completely messed up information that shouldn't be there in the first
place, phone numbers as names f.e..

that aside i made this query:

    $sql = 'SELECT table_a1.Surname, table_a2.Relation, table_a1.City
    FROM table_a1
    INNER JOIN table_a2
    ON table_a1.Relation=table_a2.Relation';w

I get a row back. my question:

is this an appropiate and common way to get this job done? im NOT used to
dig deep in this kind of stuff but i can see in the future i will need a
few handy scripts.

tips and advice are very welcome.

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

  Powered by Linux