Brug en LEFT JOIN
med PREMIUM
tabel i din forespørgsel, der kontrollerer overførselstiden. Brug derefter et match i den tabel for at betinge den tid, du sammenligner med.
$num_rows = $db->doQuery('
SELECT Class, Race, Strong, Sta, Dex, Intel, Cha, Points, TransferTime
FROM USERDATA u
LEFT JOIN PREMIUM p ON p.strAccountID = u.strUserId
WHERE strUserId = ?
AND (TransferTime < IF(p.strAccountId IS NULL,
DATEADD(DAY,-2,GETDATE()),
DATE_SUB(NOW(), INTERVAL 12 HOUR)))
OR TransferTime IS NULL)
AND zone<>199 and authority<>255', $character);