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.
| Author |
Topic |
|
DavisK
Starting Member
6 Posts |
Posted - 2005-11-03 : 16:56:09
|
| I am trying to select a dataset from one table that compares to certain criteria in another table. (i.e. select * from PR_Reservations where PR_Reservations.resource_id = Add_Record.resource_id). I get an error message stating the column prefix "Add_Record does not match with a table name or alias name used in the query." The Add_Record table is a temporary table and will only have one row of data at any given time.However, the following query works so I know it is recognizing the table: Select * from Add_Record where resource_id=4.Should I make "Declare" statements for all variables in the Add_Record table that I need to make a comparison on?What am I doing wrong? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-11-03 : 16:58:08
|
| You need to JOIN to your other table. select * from PR_Reservations rINNER JOIN Add_record arON r.resource_id = a.resource_idTara Kizer |
 |
|
|
DavisK
Starting Member
6 Posts |
Posted - 2005-11-03 : 17:09:06
|
| Of course! (*%#!)Thank you, Almighty SQL Goddess!It's going to be a long project; hope I still have some hair left at the end.Thanks! |
 |
|
|
|
|
|