Solved

sql statement mysql

Posted on 2011-03-07
3
304 Views
Last Modified: 2012-05-11
Sql statement on my sql below is work  but i not under stand

1   why no have comma  betaween SUM(quantity) SUMClaim


SELECT productcode, SUM(quantity) SUMClaim

2 i not under stand all entire statement
UPDATE product
JOIN
(
SELECT productcode, SUM(quantity) SUMClaim
FROM claimdetail
GROUP BY productcode
) claims on claims.productcode = product.ProductId
SET product.ProductQuantity = product.ProductQuantity - claims.SUMClaim

Open in new window

0
Comment
Question by:teera
3 Comments
 

Author Comment

by:teera
ID: 35064575
UPDATE product
JOIN
(
SELECT productcode, SUM(quantity) SUMClaim
FROM claimdetail
GROUP BY productcode
) claims on claims.productcode = product.ProductId
SET product.ProductQuantity = product.ProductQuantity - claims.SUMClaim
0
 
LVL 23

Accepted Solution

by:
OP_Zaharin earned 500 total points
ID: 35064673
SUM(quantity) SUMClaim - no comma means that 'the sum for quantity' header title will be displayed as SUMClaim

(check the sql result and the header title, you will find a name with SUMClaim)
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 35064714
Sumclaim is just the name you are giving to the sum of quantity. The 'as' is optional.
Select sum(quantity) as sumclaim
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question