我有两个表(radcheck和其他用户( 我想首先检查用户是否存在于"radcheck"表中 如果用户不在那里,我想检查"其他用户"表。 这就是我到目前为止所做的,但每次我尝试时都会出现错误或根本不起作用。 如果你知道我能做到的更好的方法,那也会有所帮助。谢谢
authreply_table = radcheck
authreply_table2 = otherusers
nauthorize_reply_query = "
select id, username, attribute, value, op
from ${authreply_table}
CROSS JOIN ${authreply_table2}
where username = '%{sql-user-name}'
order by id"
一次检索它们,并检查tbl
以查看它来自哪个表。
select 1 as tbl, id, username, attribute, value, op
from ${authreply_table}
where username = '%{sql-user-name}'
UNION
select 2, id, username, attribute, value, op
${authreply_table2}
where username = '%{sql-user-name}'
order by tbl,id