从mysql查询输出concated值

时间:2013-10-03 22:07:14

标签: php mysql arrays left-join concat

我正在尝试从查询中输出一个连续的值,但是我遇到了一些问题。

这是我的问题:

    $result = mysql_query(
"SELECT c.company, n.nid, n.createdOn, CONCAT_WS(' ',c2.fname,c2.lname), CONCAT_WS(' ',c3.fname,c3.lname), n.urgent, n.description 
 FROM notes n 
 INNER JOIN Positions p ON FIND_IN_SET(p.id, n.forDepts) > 0
 LEFT JOIN companies c ON c.userid = n.clientId
 LEFT JOIN companies c2 ON c2.userid = n.createdBy
 LEFT JOIN companies c3 ON c3.userid = n.claimedBy
 GROUP BY n.nid
 LIMIT 0,100"
 );

我的阵列打印如下:

Array ( [0] => Honda of Kirkland [company] => Honda of Kirkland [1] => 1 [nid] => 1 [2] => 2009-09-28 21:33:15 [createdOn] => 2009-09-28 21:33:15 [3] => [CONCAT_WS(' ',c2.fname,c2.lname)] => [4] => [CONCAT_WS(' ',c3.fname,c3.lname)] => [5] => 0 [urgent] => 0 [6] => Milestones [description] => Milestones )

我正在尝试这样,但它不起作用:

while ($row = mysql_fetch_array($result)) {
$created_by = $row[3];
}

0 个答案:

没有答案