none
SQL Level Clause error message

    Question

  • What did I do wrong?

    Here is the objective:

    Using tblDriver, tblJobOrder, and tblJobDetail, create a SQL statement to sum the estimated distance by driver. Print DriverID, JobID, Sum of Distance Estimate. Show SQL statement only and the query results.

    Here are the relationships:

    tblDriver key: Driver ID => tblJobDetail DriverID, tblJobDetail Key: JobID =>>   tblJobOrder JobID key

    Here is my SQL statement:

    SELECT tblDriver.DriverID, tblJobDetail.JobID, [SUM(tblJobOrder.DistanceEst)] AS [Sum of Distance Estimate]

    FROM tblJobOrder INNER JOIN (tblDriver INNER JOIN tblJobDetail ON tblDriver.DriverID = tblJobDetail.DriverID) ON tblJobOrder.JobID = tblJobDetail.JobID;

    GROUP BY tblDriver.DriverID

    Here is the error message:

    The LEVEL clause includes a reserved word or argument that is misspelled or missing, or the punctuation is incorrect.

    • Moved by SathyanarrayananSMVP Sunday, November 03, 2013 6:55 AM Moving it to SQL Server Data Access
    Sunday, November 03, 2013 4:09 AM

Answers

  • Hi,

    Try removing semi-colon at the end of FROM clause , like this

    SELECT tblDriver.DriverID, tblJobDetail.JobID, [SUM(tblJobOrder.DistanceEst)] AS [Sum of Distance Estimate]
    FROM tblJobOrder 
    INNER JOIN (tblDriver INNER JOIN tblJobDetail ON tblDriver.DriverID = tblJobDetail.DriverID) ON tblJobOrder.JobID = tblJobDetail.JobID
    GROUP BY tblDriver.DriverID


    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

    Sunday, November 03, 2013 6:46 AM

All replies

  • This doesn't look like an SQL Server error message, Could you confirm if you are using MS SQL Server?

    Satheesh
    My Blog


    Sunday, November 03, 2013 6:44 AM
  • Hi,

    Try removing semi-colon at the end of FROM clause , like this

    SELECT tblDriver.DriverID, tblJobDetail.JobID, [SUM(tblJobOrder.DistanceEst)] AS [Sum of Distance Estimate]
    FROM tblJobOrder 
    INNER JOIN (tblDriver INNER JOIN tblJobDetail ON tblDriver.DriverID = tblJobDetail.DriverID) ON tblJobOrder.JobID = tblJobDetail.JobID
    GROUP BY tblDriver.DriverID


    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

    Sunday, November 03, 2013 6:46 AM