Jump to content
External pictures are being replaced... ×
×
×
  • Create New...
  • 0

Query problem / WHERE conditions


pollux

Question

  • Honorable Member

Hi,

i have a problem with a query...

 

This is my working query:

SELECT l.id AS id, l.login_time AS login, l.logout_time AS logout, p.name AS name 
	FROM log.loginlog2 AS l 
	LEFT JOIN player.player AS p ON (p.id = l.pid) 
	WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) < l.logout_time
	ORDER BY l.id DESC;

 

This is my non-working query:

SELECT l.id AS id, l.login_time AS login, l.logout_time AS logout, p.name AS name 
	FROM log.loginlog2 AS l 
	LEFT JOIN player.player AS p ON (p.id = l.pid) 
	WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) < l.logout_time
	AND WHERE l.is_gm = 'Y'
	ORDER BY l.id DESC;

 

This is the error i get:

Quote

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE l.is_gm = 'Y'  ORDER BY l.id DESC' at line 5

 

Can you tell me why? Or provide me a solution? I really don't want to do a work-around in php... <_<

 

Thank you,

.PolluX

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1
  • Premium

SELECT l.id AS id, l.login_time AS login, l.logout_time AS logout, p.name AS name 
    FROM log.loginlog2 AS l 
    LEFT JOIN player.player AS p ON (p.id = l.pid) 
    WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) < l.logout_time
    AND  l.is_gm = 'Y'
    ORDER BY l.id DESC;

  • Love 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.