Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Query 1

Status
Not open for further replies.

delaap

Programmer
Jun 6, 2001
22
GB
Hi,
I'm having trouble getting a select query working, any help would be great.
I have two tables, Table1 & Table2

Table1
Site_id
05001
05002
05003
05004

Table2
Site_id Source
05001 0010
05001 0035
05002 0010
05003 0015
05004 0010
05004 0035
05004 0036

Table1 contains distinct site_id's from Table2
What I'm trying to achieve is to update Table1 with a flag
where a link to table2 on site_id is present and that table2.source is 0010 and either 0035 or 0036.

 
This query should get you started.

Update table1
Set flag=1
Where Exists
(Select * From table2
Where site_id=table1.site_id
And source='0010')
And Exists
(Select * From table2
Where site_id=table1.site_id
And (source='0035'
Or source='0036'))
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top