SELECT ord.*,usr.*,ship.* FROM order_list ord
CASE
WHEN shiptype = 'prof'
THEN (INNER JOIN user_list usr
ON ord.userid = usr.id
INNER JOIN user_list ship
ON order.userid = ship.id)
WHEN shiptype = 'brief'
THEN (INNER JOIN user_list usr
ON ord.userid = usr.id
INNER JOIN tbl_brf_shipping ship
ON order.userid = ship.id)
WHEN shiptype = 'joan'
THEN (INNER JOIN joan_user_list usr
ON ord.userid = usr.id
INNER JOIN joan_user_list ship
ON order.userid = ship.id)
END
WHERE complete = '1'
它不起作用............
答案 0 :(得分:0)
不确定您要完成的任务,但发布的查询不正确。 您似乎需要的是准备好的语句:准备查询字符串并单独执行。 详情请见:http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html