This topic is locked

Report from two tables

10/16/2007 5:16:50 PM
PHPRunner General questions
M
mkyle1 author

Hi,
I am trying to pull 2 fields from table driver (fName and sName). The common field for both tables is urn. The idea is that when I run the report it pulls in the fName and sName to the report ran from the timestamp. I believe an inner join is what is needed but have had no joy attempting to make it. Please can someone advise
Timestamp Table
select `urn`,

`location`,

`timestamp`,

`timestamp1`,

`userId`,

`time_number`,

`email_prev_u`,

`email_prev_p`,

`phone1`,

`phone2`

From `timestamp`
Driver Table

select `verified_stat`,

`fName`,

`mName`,

`sName`,

`current_emp`,

`expDate`,

`idStatus`,

`tLevel`,

`validated`,

`dateOfBirth`,

`placeOfBirth`,

`countryOfBirth`,

`trainingLvl`,

`photoRef`,

`address`,

`street1`,

`street2`,

`town_city`,

`county`,

`country`,

`postcode`,

`phone_no`,

`mobile_no`,

`email`,

`nat_no`,

`licen_no`,

`pass_no`,

`urn`,

`expDate1`,

`ID`,

`card_no`,

`tatn`,

`tdate`

From `driver`
Thanks, Martin

A
alang 10/16/2007

Try:
SELECT `timestamp`.`urn`,

`timestamp`.`location`,

`timestamp`.`timestamp`,

`timestamp`.`timestamp1`,

`timestamp`.`userId`,

`timestamp`.`time_number`,

`timestamp`.`email_prev_u`,

`timestamp`.`email_prev_p`,

`timestamp`.`phone1`,

`timestamp`.`phone2`,

`driver`.`fName`,

`driver`.`sName`

FROM `timestamp`

INNER JOIN `driver`

ON `timestamp`.`urn`=`driver`.`urn`

M
mkyle1 author 10/19/2007

Hi,
thanks it did the business.
Martin <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=22384&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />