SQL SERVER/ASP syntax error near INNER

I have two databases on separate SQL servers. They have been linked in SQL Server. I can't move the databases to the same server. I am trying to use an inner join to display a small set of specific information. Basically I need to display one column from database A(NurQueryResults) if the VisitID = the Account Number from database B. I have succesfully connected to both databases (using a connection string) indivdually in the asp page with separate connection strings. I have verified the column names in each database. I'm getting a syntax error in my SQL code. Here is the code I'm trying to use:\[code\] SELECT Response, VisitID, QueryID, RowUpdateTime FROM [dbo].NurQueryResults WHERE QueryID = FALL.RISK1INNER JOIN [dbo].View_CareProviderWithPatientAtLocationON [dbo].NurQueryResult.VisitID = [dbo].View_CareProviderWithPatientAtLocation.AccountNumber ORDER BY RowUpdateDateTime DESC\[/code\]I'm using Dreamweaver. The page is .asp and I'm have been using the Insert Recordset command. That is the area I am trying to enter the above code in to. I get the syntax error when I try the "test" button in the recordset window. I have tried listing out the server/database name/table name for database B and still received the syntax error. Is it something incorrect in the SQL code? Or do you think it has to do with my connection to the linked server? Or should I be taking a completey different approach to get that data?
 
Back
Top