dot notations, joins, and more fun
Posted: Fri Feb 17, 2006 12:50 pm
feyd | Please use
If I remove
It returns a three results and repeats them three times so I slao tried
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I am trying to do a join using dot notation and it isn't working out very well. I am selecting from my videos table and then when a foreign key is in a row, such as person_id, I am trying to get the person's name from the person table. Here's my query:Code: Select all
$query = "select
v.videos_id,
p.name,
v.video_thumb,
l.location_id,
v.date_ed
from
videos as v,
people as p,
locations as l,
crises as c
where
v.crisis_id = $id
and
p.person_id = v.person_id
and
l.location_id = v.location_id
and
c.crisis_id = v.crisis_id
order by
year(v.date_rec),
month(v.date_rec),
day(v.date_rec)
limit 10";Code: Select all
and
p.person_id = v.person_id
and
l.location_id = v.location_id
and
c.crisis_id = v.crisis_idCode: Select all
select distinct
v.videos_id..." but then it returned no results.
I'm sorry if this is a stupid question...
oh, and let me know if you would like the table schemas.
Thanks,
bfeyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]