Jump to content
Sign in to follow this  

What Is the SQL QUERY of the

Recommended Posts

RcptNo Discoount ProductCode Price
111 10 1122 1000
111 10 1123 1500
111 10 1124 2000
123 20 1123 2000
124 30 1125 1000
124 30 1120 2000
I want This Result
Rcpt No:111
Discount :10
TOT price :1000+1500+2000-10=------;
By Which Query This Result can be Obtained

Share this post

Link to post
Share on other sites

not sure if this will work, but worth a shot.



SELECT RcptNo, Discount, ProductCode, ((SELECT SUM(Price) FROM table WHERE RcptNo = 111) - Discount) as TotalPrice FROM table WHERE RcptNo = 111

Share this post

Link to post
Share on other sites

Join the conversation

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

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.

Sign in to follow this  

  • Create New...