Link to home
Create AccountLog in
Avatar of katlees
katleesFlag for United States of America

asked on

Inner Join Question

I need help with an inner join sql statement
Two tables are:

TABLE: Passes1
PassID
SoldBy
THID
BoxNumber
Year

TABLE: TicketHolders
HolderID
LName
AllNames

Here is my SQL
$press_query = "SELECT * FROM Passes1 WHERE Year = '2013' AND THID <> '2059'

It is displaying like this
Passes1.SoldBy, Passes1.TicketType, Passes1.THID, Passes1.BoxNumber

I need the Passes1.THID to show the TicketHolders.LName and TicketHolders.AllNames
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
The solution offered by sedgwick is ok. However, if field THID on Passes1 table can be NULL, then you an consider to change INNER JOIN by LEFT JOIN so you will get any record from Passes1 even if it has no holder associated to it.

Hope it helps.
Avatar of katlees

ASKER

Thank you!