I've got a database with every dorm room on campus (thousands of rooms.) Most of the rooms are doubles so there are two beds. Currently the database will have two records for double rooms i.e. Beech 101 and Beech 101. I need to add a field that will denote the separate beds like Beech 101 A and Beech 101 B.
I figured the best way to do this was to run a distinct query on all of the rooms (housing.UnitName), so it would only turn up each room once, and set the BedName field to "A". Then I could go back and update all null values to "B". (hope this is making sense so far.)
I got my distinct query just fine:
SELECT DISTINCT Housing.UnitName, Housing.BedName FROM Housing
This returns all the records that I need to set BedName to "A", however I can't update this query. So, I tried this:
SELECT *
FROM Housing
WHERE UnitName in (SELECT DISTINCT Housing.UnitName FROM Housing);
While this query is updateable, it doesn't return distinct values. (I get Beech 101 twice etc.)
Is there a way to do what to acomplish what i'm trying to do? Thanks in advance!
brian
I figured the best way to do this was to run a distinct query on all of the rooms (housing.UnitName), so it would only turn up each room once, and set the BedName field to "A". Then I could go back and update all null values to "B". (hope this is making sense so far.)
I got my distinct query just fine:
SELECT DISTINCT Housing.UnitName, Housing.BedName FROM Housing
This returns all the records that I need to set BedName to "A", however I can't update this query. So, I tried this:
SELECT *
FROM Housing
WHERE UnitName in (SELECT DISTINCT Housing.UnitName FROM Housing);
While this query is updateable, it doesn't return distinct values. (I get Beech 101 twice etc.)
Is there a way to do what to acomplish what i'm trying to do? Thanks in advance!
brian