Getting an error message on an inner join

When I try to run the following query I get the error, “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’ at line 5”

Any ideas?

Thanks!

SELECT
   u.uID,
   u.last,
   l.loginDate,
 FROM users u
INNER
 JOIN logins l
   ON u.uID = l.uID
WHERE
  l.loginDate >= u.last
GROUP BY
 u.uID
ORDER BY u.last
  limit 1000;

loginDate is followed by a comma - should not be there

and that error would be a lot harder to make using the leading comma convention –

SELECT u.uID
     , u.last
     , l.loginDate
     ,  
  FROM users u
... 

:slight_smile:

But that’s such an ugly way to code SQL. :wink:

ugly is in the eye of the beholder :cool:

do a forum search, you will find a half dozen threads where someone made the same error, then the leading comma convention was brought up, then someone new was converted

you, too, will see the light one day :slight_smile: