sc_field_display with INNER JOIN

Hi,

I have this command in my sql.

SELECT
a.userid, b.username, a.lastlogin
FROM
logfile a INNER JOIN users b
WHERE
a.userid = b.userid
ORDER BY
a.userid

This work perfectly for me until customer request me to hide the username for non-admin.

I try to place this code in Events->onScriptinit with
sc_field_display(“b.username”, “off”); or
sc_field_display(“username”, “off”);
but the field remain appeared.

I have lots of file using above SELECT method. Any idea?

I did test on create the log file with userid, username, lastlogin and the SQL coding become
SELECT
userid, username, lastlogin
FROM
logfile
ORDER BY
userid

and this command work perfectly.
sc_field_display(“username”, “off”);
the field hide.

Any suggestion?

Regards,
CK

Re: sc_field_display with INNER JOIN

Try

SELECT
a.userid, b.username AS busername, a.lastlogin
FROM
logfile a INNER JOIN users b
WHERE
a.userid = b.userid
ORDER BY
a.userid

and

sc_field_display(“busername”, “off”);

HTH