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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Got the data with Select, How to Update?

Author  Topic 

tampasounds
Starting Member

6 Posts

Posted - 2007-05-13 : 23:53:06
Hi all, have a pretty simple query. but am new to workin in multiple tables. This statement shows
Items in table1 that exists in table2 that match a filter.

I would like to change this query to update the TOBEDELETED column to 'F' based on the same column and filter match.


SELECT ITEMS.ITEMNO, ITEMS.TOBEDELETED
FROM ITEMS
INNER JOIN QLOG
ON ITEMS.ITEMNO=QLOG.SOURCEID
WHERE QLOG.SOURCE= 'ITEMS'

Thanks all in advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-13 : 23:57:34
[code]
UPDATE i
SET TOBEDELETED = 'F'

SELECT ITEMS.ITEMNO, ITEMS.TOBEDELETED
FROM ITEMS i
INNER JOIN QLOG q
ON i.ITEMNO=q.SOURCEID
WHERE q.SOURCE= 'ITEMS'
[/code]


KH

Go to Top of Page

tampasounds
Starting Member

6 Posts

Posted - 2007-05-14 : 00:08:00
HI THANKS,

Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'QLOG' does not match with a table name or alias name used in the query.
Server: Msg 107, Level 16, State 1, Line 1
The column prefix 'ITEMS' does not match with a table name or alias name used in the query.
Server: Msg 107, Level 16, State 1, Line 1
The column prefix 'QLOG' does not match with a table name or alias name used in the query.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-14 : 00:11:08
Sorry forgot to changed the table reference. I have amended the query.


KH

Go to Top of Page

tampasounds
Starting Member

6 Posts

Posted - 2007-05-14 : 00:14:07
That did the trick! Thanks so much!
Go to Top of Page
   

- Advertisement -