help for a query

Posted by stighy on Stack Overflow See other posts from Stack Overflow or by stighy
Published on 2010-05-28T15:03:55Z Indexed on 2010/05/28 15:12 UTC
Read the original article Hit count: 127

Filed under:

Hi, i've a problem for a table update. follow table structure:

Table1
  tableid
  ...
  ... 
  productID_1
  productID_2
  productID_3

Table2
  productID
  Total

I've to totalize each product in table2.

For example:

SELECT COUNT(*) as tot, ProductID_1 FROM Table1 GROUP Table1 

then the UPDATE table2 SET total =..??? (how can i do) WHERE productID_1 = ....

Hope you can help me.

Thank you

© Stack Overflow or respective owner

Related posts about sql