Answered by:
Delete specific row

Question
-
Hi,
Could you please help me about the below question?
I want to delete the row from temp-store table that has same store_no,id,date,product_no and the sum(qty)=0
Create table temp-store(Stor_no int,
Id int,
Date varchar(10),
product_no int,
qty int)
insert into temp_store(Store_no,id,date,
product_no,qty) values (2,1332,’20180428’,100,7),
(2,1330,’20180428’,100,0),
(2,1381,’20180428’,100,7),
(2,1369,’20180428’,100,-7),
(2,1369,’20180428’,100,7),
(2,1390,’20180429’,100,12),
(2,1390,’20180429’,100,12),
(3,1360,’20180515’,100,-6),
(3,1360,’20180515’,100,6),
(3,1360,’20180515’,100,6),
(3,1360,’20180515’,100,12)
I need to get the below result:
Store_no,id,date,product_no,
qty 2,1332,’20180428’,100,7
2,1330,’20180428’,100,0,
2,1381,’20180428’,100,7
2,1390,’20180429’,100,12
2,1390,’20180429’,100,12
3,1360,’20180515’,100,6
3,1360,’20180515’,100,12
- Moved by Dave PatrickMVP Wednesday, November 13, 2019 4:02 AM looking for forum
- Edited by AranSQL Wednesday, November 13, 2019 6:35 PM
- Edited by Richard MuellerMVP, Banned Wednesday, November 13, 2019 7:09 PM Removed unsupported Grammarly tags
Wednesday, November 13, 2019 3:35 AM
Answers
-
Assuming SQL Server, I'd ask for help over here.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Richard MuellerMVP, Banned Wednesday, November 13, 2019 10:14 AM
- Marked as answer by Richard MuellerMVP, Banned Wednesday, November 20, 2019 1:26 PM
Wednesday, November 13, 2019 4:02 AM
All replies
-
Assuming SQL Server, I'd ask for help over here.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Richard MuellerMVP, Banned Wednesday, November 13, 2019 10:14 AM
- Marked as answer by Richard MuellerMVP, Banned Wednesday, November 20, 2019 1:26 PM
Wednesday, November 13, 2019 4:02 AM -
Sorry, it doesn't work for me
I need to figure out it soon.
- Edited by AranSQL Wednesday, November 13, 2019 6:36 PM
Wednesday, November 13, 2019 6:35 PM -
This is "where is" forum for direction on where best to ask questions, so I'd ask in forums I linked.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.
- Edited by Dave PatrickMVP Wednesday, November 13, 2019 7:24 PM
Wednesday, November 13, 2019 6:37 PM -
Thanks, I got it.
- Edited by AranSQL Wednesday, November 13, 2019 8:34 PM
Wednesday, November 13, 2019 8:34 PM -
You're welcome.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.Wednesday, November 13, 2019 9:40 PM