我有这个问题:
我有SQL声明:
SELECT Amount FROM cicmpy
INNER JOIN (SELECT DealerCode, sum(Amount) as Amount FROM
(SELECT DealerCode, LOG as LogtLimit,TemporaryCreditLimit as TemporaryCreditLimit,
CASE WHEN TemporaryCreditLimit>0 then TemporaryCreditLimit ELSE LOG END as Amount
FROM LOG_DATA WHERE Status = 1 group by DealerCode) x
on x.DealerCode=debcode where debnr is not NULL and ltrim(debcode) = '21021287'`
我希望这个语句进入php $查询变量。
答案 0 :(得分:0)
尝试这样,它将解决您的错误。
$sql = "Put your query"; //put your query in php variable
$result = mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($result)) {
do stuff...
}