Help with Lua/SQL Query -

This is a line from Lexi’s Sourceban Module only edited slightly to have expiration dates for user groups.

[lua]
[“Select Users”] = “SELECT a.aid, a.user, a.authid, a.srv_group, a.srv_flags, a.immunity FROM %s_admins a, %s_admins_servers_groups g WHERE g.server_id = %i AND DATEDIFF(g.expires, CURDATE()) > 0 AND g.admin_id = a.aid”;
[/lua]
this works fine, however I need to add something like “OR g.server_id = 0”.

I do know some lua and some MySQL but it seems no matter what I try I keep breaking the damn thing. I had tried:

[lua]
[“Select Admins”] = “SELECT a.aid, a.user, a.authid, a.srv_group, a.srv_flags, a.immunity FROM %s_admins a, %s_admins_servers_groups g WHERE g.server_id = %i OR g.server_id = 0 AND DATEDIFF(g.expires, CURDATE()) > 0 AND g.admin_id = a.aid”;
[/lua]

and

[lua]
[“Select Admins”] = “SELECT a.aid, a.user, a.authid, a.srv_group, a.srv_flags, a.immunity FROM %s_admins a, %s_admins_servers_groups g WHERE (g.server_id = %i OR g.server_id = 0) AND DATEDIFF(g.expires, CURDATE()) > 0 AND g.admin_id = a.aid”;
[/lua]
Neither of which worked, any helped would be appreciated :slight_smile:

try


WHERE g.server_id = %i || 0

|| in an sql query?

[editline]5th July 2011[/editline]

[“Select Admins”] = “SELECT a.aid, a.user, a.authid, a.srv_group, a.srv_flags, a.immunity FROM %s_admins a, %s_admins_servers_groups g WHERE (g.server_id = %i OR g.server_id = 0) AND DATEDIFF(g.expires, CURDATE()) > 0 AND g.admin_id = a.aid”;

Grabbed help from someone, was so obvious after looking at it…

/close
/end
/0