3
我想在C選用顯示一個從MySQL數據庫的選擇查詢:不能得到選擇查詢工作
mysql_query(conn,"SELECT SI AS SUBSCRIBER_ID ,TG2 AS TAG_ID, SUM(CTR) AS NBR FROM (SELECT H.SUBSCRIBER_ID AS SI, TG.TAG_ID AS TG1,T.TAG_ID AS TG2, COUNT(TG.TAG_ID) AS COUNTER,CASE WHEN (TG.TAG_ID = T.TAG_ID) THEN COUNT(TG.TAG_ID) ELSE 0 END AS CTR from content_hits H left join CONTENT_TAG TG ON TG.CONTENT_ID = H.CONTENT_ID LEFT JOIN TAG T ON 1= 1 GROUP BY H.SUBSCRIBER_ID, TG.TAG_ID,T.TAG_ID) AS TAB GROUP BY SI,TG2");
在那之後,我想用「NBR」,以填補一維數組。
我嘗試這樣做:
result = mysql_store_result(conn);
while ((row = mysql_fetch_row(result)))
{
t[i]=*row['NBR'];
printf("%d",t[i]);
}
但沒有奏效。
http://mattgemmell.com/2008/12/08/what-have-you-tried/ – 2012-04-10 12:59:16
@holy它怎麼不起作用?有錯誤消息嗎?意外的結果?請更具體地說明問題所在。 – 2012-04-10 13:48:36
你能編輯你的文章並添加查詢,也許表格的模式? – octopusgrabbus 2012-04-10 14:15:57