0

I am getting the following syntax error when running the below query.

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM shorewarecdrarchive.connect LEFT JOIN shorewarecdrarchive.call ' at line 28

Line 28 is the FROM part of the query.

SELECT
    call.Extension,
    -- agentactivity.AgentDN,
    -- agentactivity.AgentFirstName,
    -- agentactivity.AgentLastName,
    -- agentactivity.WorkgroupDN,
    -- agentactivity.WorkgroupName,
    call.DialedNumber,
    connect.PartyID,
    call.CallerID,
    connect.PartyIDName,
    connect.PartyIDLastName,
    -- agentactivity.StartTimeStamp,
    call.StartTime,
    date(call.StartTime),
    time(call.StartTime),
    hour(call.StartTime),
    call.EndTime,
    -- agentactivity.EndTimeStamp,
    call.CallType,
    call.ID,
    connect.PartyType,
    connect.ConnectReason,
    connect.TalkTimeSeconds,
    connect.duration,
    call.duration,
    -- agentactivity.State
FROM shorewarecdrarchive.connect
LEFT JOIN
    shorewarecdrarchive.call ON connect.CallTableID = call.ID
-- LEFT JOIN
-- shorewarecdrarchive.agentactivity ON call.Extension = agentactivity.AgentDN
WHERE
-- StartTimestamp >= '2016-12-05 08:20:00'
-- AND StartTimestamp < '2016-12-05 08:40:00'
-- AND PartyIDName NOT IN ('Overhead Paging','Voice Mail','Voice Mail Login','Door','Door Intercom','Main Line Hunt Group','Main Line','Sales','ACT','Auto-Attendant','Night Bell','Backup Auto-Attendant','Dispatch','North', 'North Lunch')
-- AND WorkgroupName NOT IN ('Dispatch' , 'Main Line')
-- AND CallType between 1 and 3
-- Calltype 1 = Extension to extension call.
-- CallType 2 = A trunk is the originating party. (Inbound calls)
-- Calltype 3 = An extension is originating and a trunk is called. (Outbound calls)
-- CallType 4 = A call originating from a trunk and going to a trunk. (Tie trunks)
-- AND agentactivity.WorkgroupName = 'Sales' or'Pre-sales' or 'QFC Orders'
-- and call.id = '402300'
call.ID = '612916'
order by call.ID ASC;

Can anyone take a look and let me know what I am not seeing; I am pretty sure it's something simple, though I am having one of those 'to close to the painting' situations.

closed as off-topic by MDCCL, Erik, Tom V, paparazzo, Paul White Dec 9 '16 at 9:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – MDCCL, Erik, Tom V, paparazzo, Paul White
If this question can be reworded to fit the rules in the help center, please edit the question.

0

Change

    call.duration,
-- agentactivity.State
FROM shorewarecdrarchive.connect

to

call.duration --removing the comma
-- agentactivity.State
FROM shorewarecdrarchive.connect

or

call.duration,
agentactivity.State --uncommenting this line
FROM shorewarecdrarchive.connect

The problem is the trailing comma at the end of call.duration

Not the answer you're looking for? Browse other questions tagged or ask your own question.