我在下面有以下代码:我想以不同的方式订购查询结果。
$db = $this->database[GDB];
$num_rows = $db->doQuery('SELECT TOP 100 strUserId, TotalTime, Nation, LoginDT FROM USERDATA WHERE Authority IN(1, 2) ORDER BY TotalTime DESC');
if ($num_rows == -1)
{
$db->getError();
return;
}
我想做的是以下内容:
ORDER BY
喜欢这样:
TotalTime + (time() + 7200 - LoginDT) DESC // this doesnt work for some reason, no error message but it doesnt select any ... so there must be something wrong?
我在上面的查询中如何做到这一点?
我使用MSSQL Server 2005
编辑:
......
$db->doQuery('INSERT INTO Competition (AID, TimeRaffle, TRaffle, TicketNum) VALUES (?, ?, GetDate(), ?)', $_SESSION['Acc'], time(), $ticket);
......