SELECT
0
,getip.lastloginip
,getip.location
,info.uid as userID
,info.truename
,left(CAST(SUBSTRING(idnumber,7,8) AS DATETIME),4) AS BIRTHDAY_YEAR#this is IMPORTANT
,FROM_UNIXTIME(UNIX_TIMESTAMP(CAST(SUBSTRING(idnumber,7,8) AS DATETIME)),’%m-%d’) AS BIRTHDAY#this is IMPORTANT
,MOD(right(idnumber,2),2) AS SEX
FROM p2p_member_security info, p2p_member getip
WHERE
1
and info.uid = getip.uid
and idnumber != ‘’
and idnumber is not null
and (length(idnumber) = 18 or length(idnumber) = 15)
ORDER BY BIRTHDAY desc;