My database is named "pugetsound." What I want to do, conceptually:
1. Select all records with PLACE = XYZ.
2. Count how many of those selected records have XWALK = A or B or C.
3. If that is 2 or more, update the EPU_Flag field with a '1' for all those records where PLACE = XYZ.
This almost works but not quite; I get a "syntax error (missing operator)."
Update pugetsound
Set EPU_Flag = 1
From pugetsound
Inner Join (
Select PLACE
From pugetsound
Where PLACE = '01' AND XWALK In ('ESS', 'RSS', 'REM', 'EEM', 'INT')
Group By PLACE
Having Count(*) >= 2) As temp
On pugetsound.PLACE = temp.PLACE
1. Select all records with PLACE = XYZ.
2. Count how many of those selected records have XWALK = A or B or C.
3. If that is 2 or more, update the EPU_Flag field with a '1' for all those records where PLACE = XYZ.
This almost works but not quite; I get a "syntax error (missing operator)."
Update pugetsound
Set EPU_Flag = 1
From pugetsound
Inner Join (
Select PLACE
From pugetsound
Where PLACE = '01' AND XWALK In ('ESS', 'RSS', 'REM', 'EEM', 'INT')
Group By PLACE
Having Count(*) >= 2) As temp
On pugetsound.PLACE = temp.PLACE