Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 query with join

Author  Topic 

timcyberbanjo
Starting Member

3 Posts

Posted - 2009-10-06 : 20:26:48
Hi,
I have a 2 tables. (program_schedule_view) that contains many program_id's and another (station_program_profile) that contains only a selected few program_id's.
Both tables have the common field called "program_id". I can therefore join the two tables based on that.
What I need to do is create a view that contains a distinct list of every program_id in program_schedule_view merged with the program_id's that exist in station_program_profile

My attempts seem to keep ending up with just a list of the program_id's that exist in both tables.

SELECT
distinct spv.program_id,
spp.live_selected_ind, spp.record_selected_ind
FROM
program_schedule_view spv LEFT OUTER JOIN station_program_profile spp ON spv.program_id = spp.program_id
WHERE
Spp.station_id ='tim'

Tim Saunders
check out www.seagrassmusic.com

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-07 : 02:30:28
select program_id from table1
union all
select program_id from table2


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -