|
When using the Where Exists in this context, do I need a separate Existsclause for each join pair that I am using or can I place it in one
Ex. Update column Amount in table OpenAR with the total of column InvAmtfrom table InvHdr when column Company in table OpenAR matches column
Which SQL statment would be correct:Company = InvCmpny and Customer = InvCust)
1. Update OpenAR Set Amount = (Select Sum(InvAmt) from InvHdr where
Where Exists ((Select 1 from InvHdr where Company= InvCmpny and Customer = InvCust)
Company = InvCmpny and Customer = InvCust)
2. Update OpenAR Set Amount = (Select Sum(InvAmt) from InvHdr where
Where Exists (Select 1 from InvHdr where Company =InvCmpny) and Exists (Select 1 from InvHdr where Customer = InvCust)
In fact, you must place it in one statement. Think about it: the point
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.