Link to home
Start Free TrialLog in
Avatar of garyrobbins
garyrobbinsFlag for United States of America

asked on

Understanding SQL

Below is the SQL Statement I am trying to alter.  Can someone help me under stand what the
FROM portion is stating.

SELECT
      B.ORDER.DATE,
      B.ITEM.DESCRIPTION,
      B.QUANTITY,
      B.AMOUNT.BILLED,
      B.CANCEL.DATE,
      B.TYPE.OF.CANCEL,
      B.DAL.CANCELLED.BY,
      B.DAL.REASON.NOTES,
      B.DAL.REASON.TEXT,
      B.BILL.DATE,
FROM
      BILLING.TRANSACTIONS AS B LEFT OUTER JOIN DAILY.ACTIVITY.LOG AS D ON B.@ID = CAST
      (D.BILLING.TRANSACTION.NUM AS VARCHAR)
WHERE
      B.CANCEL.DATE = CURRENT_DATE
      AND B.CANCEL.DATE > CURRENT_DATE - 1
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

The SQL's not valid.  The @ in that location is not valid, and the extra '.'s in the column names are not valid.

Other than the syntax errors, though, it's a standard LEFT JOIN: from table1 left join to table2.
Scott's right. The syntax is slightly missed up, but what exactly are you asking?

Do you understand LEFT OUTER JOIN?
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
by the way, are you actually using Microsoft SQL Server?
if not, what is your database type please?
Avatar of garyrobbins

ASKER

Thank you for the thorough response it answered some other questions i had also.