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
 SQL Update using join

Author  Topic 

bjstyl2
Starting Member

12 Posts

Posted - 2015-01-29 : 15:00:38
UPDATE sku
set ecomm = 1
from sku
join invt
on sku.style = invt.style
where invt.first_rcvd = '12/22/2014'

I keep getting an error using this query. Can anyone see anything I might be doing wrong? It keeps failing at the "FROM" portion.

What I want to do is update column ECOMM within table SKU if the STYLE has been received on a certain date.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-01-29 : 15:04:09
Please post the error. I'm not spotting an issue. Is this the only thing in your query window?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-01-29 : 15:05:07
Oh and are you using Microsoft SQL Server or MySql? I noticed in a previous post of yours that it was MySql. I am not sure of the MySql syntax, but what you posted would work on MS SQL Server.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

bjstyl2
Starting Member

12 Posts

Posted - 2015-01-29 : 15:09:16
I believe this is a Microsoft SQL Server (database tables for an executable windows based program). The past topics were for website coding issues...

The error I am getting is "Dynamic SQL Error SQL error code = -104 Token unknown - line 3, char -1 from."
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-01-29 : 15:13:11
Looks like it's an issue with the tool you are using to run the query. If you are using Microsoft SQL Server, then try the query in SQL Server Management Studio.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -