emblewembl
Programmer
I have a view which gives me a list of data - here's the code:
I also want to pull in one more value (let's call it newVal) from another table, NewTable, but in NewTable there may only be a reference to 10 of the items currently being returned in my list. If I change the stored procedure to:
I'll get only the runners back who have a value in NewTable. What I actually want is to get my original list of runners back with a value for NewVal if found in NewTable, otherwise a null.
How do I do this?
i love chocolate
Code:
CREATE view iVRunners
as
select r.racecardid, r.trackid, r.coursesurface, e.entryid, e.programNo
from racecards r, schedules s, entries e
where r.racedate = s.mDate
and e.racecardid = r.racecardid
group by r.racecardid, e.entryid, r.trackid, r.coursesurface, e.programNo
I also want to pull in one more value (let's call it newVal) from another table, NewTable, but in NewTable there may only be a reference to 10 of the items currently being returned in my list. If I change the stored procedure to:
Code:
CREATE view iVRunners
as
select r.racecardid, r.trackid, r.coursesurface, e.entryid, e.programNo, o.newVal
from racecards r, schedules s, entries e, newTable o
where r.racedate = s.mDate
and e.racecardid = r.racecardid
and e.entryid = o.entryid
group by r.racecardid, e.entryid, r.trackid, r.coursesurface, e.programNo, o.newVal
I'll get only the runners back who have a value in NewTable. What I actually want is to get my original list of runners back with a value for NewVal if found in NewTable, otherwise a null.
How do I do this?
i love chocolate