Stack Overflow
Stack Overflow

Reputation: 247

what;s wrong with my sql query?

what;s wrong with my query ...

i get the error message #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 '. mail_time FROM ibc_messages m , ibc_msg_queue q AND m . id = q . msgid AND q' at line 1

SELECT distinct q.msgid, q.mail_time, m.status,
FROM ibc_msg_queue q , ibc_messages m
WHERE q.mail_time = '0000-00-00 00:00:00' AND q.msgid = m.id
ORDER BY q.msgid

Upvotes: 0

Views: 116

Answers (4)

BWS
BWS

Reputation: 3836

You have an extra comma in there:

YOURS:

SELECT distinct q.msgid , 
       q.mail_time,
       m.status, 
FROM ibc_msg_queue q , ibc_messages m
WHERE q.mail_time = '0000-00-00 00:00:00' 
  AND q.msgid = m.id 
ORDER BY q.msgid

Upvotes: 1

Mureinik
Mureinik

Reputation: 311338

You have a redundant comma (,) before your FROM keyword. Just remove it, and you should be fine:

SELECT distinct q.msgid , q.mail_time,m.status
FROM ibc_msg_queue q , ibc_messages m
WHERE q.mail_time = '0000-00-00 00:00:00' AND q.msgid = m.id ORDER BY q.msgid

Upvotes: 1

hrezs
hrezs

Reputation: 782

remove the comma after your third column

SELECT distinct q.msgid , q.mail_time,m.status FROM

Upvotes: 3

DRapp
DRapp

Reputation: 48139

You have an extra comma before the "FROM" clause

Upvotes: 2

Related Questions