|
I am stuck on this problem and instead of wasting more hours trying different ways I thought I would ask for help. "Write a SELECT statement that returns three columns: VendorName From the Vendors table DefaultAccountNo From the Vendors table Account Description From the GLAccounts table The result set should have one row for each vendor, with the account number and account description for that vendor's defaultaccount number. Sort the result set by AccountDescription, then by VendorName. Below is my latest attempt at this but still has errors: SELECT AccountDescription, VendorName, DefaultAccountNo FROM Vendors JOIN GLAccounts ON DefaultAccountNo = AccountNo WHERE GLAccounts.AccountDescription = Vendors.DefaultAccountNo ORDER BY AccountDescription, VendorName Any help is appreciated.
(comments are locked)
|
|
You have already made the JOIN on both tables with seemingly correct fields i.e. So there is no need to have this statement in the WHERE clause Practically the above statement does not make sense as AccountDescription (e.g. "Expense Account") cannot be equal to DefaultAccountNo (e.g. 01000101). This is why an error would have been generated because of the non-compatible fields (Assuming DefaultAccountNo is numeric field and AccountDescription is a character field). I beleive you should visit BOL to get more insight.
(comments are locked)
|


is this a homework question?
Since you have put an effort to solve this, you deserve some help. But please let us know if it is the homework, so we can tag it correctly.