Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

Once again SQL is driving me up the wall. I know this is not an SQL forum, but this is my last resort to get this App to work.

 

Scenario: Two tables, (MS ACCESS)

T_Sellers - Listing all the seller information

T_Sales - Listing all sales by product.

 

I am wanting to update a field in T_Sellers which is the total number of sales for that seller (NumOfSales). I have written this update query:

 

UPDATE T_Sellers SL

SET NumOfSales = (SELECT Count(*)

FROM T_Sales SA

WHERE SA.Seller = SL.ROW_ID)

 

I am getting the following error message:

"Operation must use an updateable query"

 

I dont understand what is happening... this should work!

 

Thanks in advance for your help!!

 

Regards

Angus

  • *Experts*
Posted

I know in SQL Server you can't alias a table in the UPDATE clause. But you'll get a different error than what you've said. Otherwise, the query looks fine to me (in SQL Server - never tried a subquery in Access before).

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...