3

作为以下查询的结果,我有一个带有值的变量

select concat_ws(',',name,age) from table1 
inner join table2 on table1.id=table2.id 
where table1.height=150

它的结果存储在变量$result中,在另一个页面中我想在新查询中使用这个 $result 在 where 条件如下

select address, state form table1 
where (**select concat_ws(',',name,age) from table1 inner join table2 
on table1.id=table2.id**)as val=$result

如何在查询中使用此条件?

4

1 回答 1

0

我不确定为什么你不能使用像这样简单的东西:

SELECT address, state FROM table1 
INNER JOIN table2 ON table1.id=table2.id 
WHERE concat_ws(',',name,age) = '$result'
于 2013-09-24T07:35:09.320 回答