[英]appending value returned from query
I am trying to return all data of exp_matrix_data.col_id_1 我正在尝试返回exp_matrix_data.col_id_1的所有数据
select col_id_
(select col_id from exp_matrix_cols
left join exp_channel_fields on exp_matrix_cols.field_id = exp_channel_fields.field_id
where exp_channel_fields.field_name = 'transfer_agreement_field'
and exp_matrix_cols.col_name = 'school_name')
from exp_matrix_data
the select within the ( ) returns 1, that retrieves the correct id to be added to col_id_, so I can do: ()中的select返回1,它检索要添加到col_id_的正确ID,所以我可以这样做:
select col_id_1 from exp_matrix_data
This does not work, but will give you an idea of what I am trying to accomplish. 这行不通,但是会让您对我要完成的事情有所了解。
您需要使用动态查询,请阅读以下内容: http : //dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.