-
Jun 26th, 2017, 11:46 AM
#1
Thread Starter
New Member
sql help
i need to substract the two columns sum(aantal) off the 2 sql commands , is it possible to put the 2 commands into one ?
how can i do that ?
"SELECT tblAKLeveringen.BestelbonId,BestelbonArtID, sum(Aantal) as GeleverdAantal " &
"FROM tblAKLeveringenArt " &
"LEFT JOIN tblAKLeveringen on tblAKLeveringenArt.LeveringsbonID = tblAKLeveringen.ID " &
"WHERE tblAKLeveringen.BestelbonId = '" & intBestellingID & "' and bestelbonArtID='" & Opmaak.BestelbonArtID & "' and tblAKLeveringen.Status <>'Opmaak' "
"GROUP BY BestelbonID, bestelbonArtID "
and
"SELECT tblAKRetour.BestelbonId,BestelbonArtID,HoeAfhandelen, sum(Aantal) as GeleverdAantal " &
"FROM tblAKRetourArt " &
"LEFT JOIN tblAKRetour on tblAKRetourArt.RetourbonID = tblAKRetour.ID " &
"WHERE tblAKRetour.BestelbonId = '" & intBestellingID & "' and bestelbonArtID='" & Opmaak.BestelbonArtID & "' and tblAKRetour.Status <>'Opmaak " &
" and HoeAfhandelen = 'Nog te leveren' " &
"GROUP BY BestelbonID, bestelbonArtID ")
Last edited by jdsoft; Jun 26th, 2017 at 12:06 PM.
-
Jun 27th, 2017, 09:49 AM
#2
Re: sql help
subtract which from which?
Here they are combined subtracting the second from the first.
Code:
"SELECT tblAKRetour.BestelbonId,BestelbonArtID,HoeAfhandelen, sum(Aantal) as GeleverdAantal " &
"FROM tblAKRetourArt " &
"LEFT JOIN tblAKRetour on tblAKRetourArt.RetourbonID = tblAKRetour.ID " &
"WHERE tblAKRetour.BestelbonId = '" & intBestellingID & "' and bestelbonArtID='" & Opmaak.BestelbonArtID & "' and tblAKRetour.Status <>'Opmaak " &
" and HoeAfhandelen <> 'Nog te leveren' " &
"GROUP BY BestelbonID, bestelbonArtID ")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|