MySQL查询输出

时间:2015-07-07 20:07:15

标签: mysql

我是MySql的新手,我在尝试运行查询时遇到了问题。

最终我正在尝试运行查询以在表格中显示。

我的查询是:

    SELECT 

        users.user_email AS n_user_user_email,
        t1.meta_value AS n_user_first_name, 
        t2.meta_value AS n_user_last_name, 
        t3.meta_value AS n_user_profile_picture, 
        t4.meta_value AS n_user_position, 
        t5.meta_value AS n_user_hours, 
        t6.meta_value AS n_user_status, 
        t7.meta_value AS n_user_type

FROM users
LEFT JOIN usermeta AS t1 ON t1.user_id = users.ID 
LEFT JOIN usermeta As t2 ON t1.user_id = t2.user_id 
LEFT JOIN usermeta AS t3 ON t2.user_id = t3.user_id  
LEFT JOIN usermeta AS t4 ON t3.user_id = t4.user_id 
LEFT JOIN usermeta AS t5 ON t4.user_id = t5.user_id 
LEFT JOIN usermeta As t6 ON t5.user_id = t6.user_id 
LEFT JOIN usermeta AS t7 ON t6.user_id = t7.user_id  


WHERE t1.meta_key = 'first_name' 
AND t2.meta_key = 'last_name' 
AND t3.meta_key = 'profile_picture' 
AND t4.meta_key = 'position'
AND t5.meta_key = 'hours' 
AND t6.meta_key = 'status'
AND t7.meta_key = 'type'

我的问题在于输出。例如,位置字段输出如下:5:{i:0; s:14:" Manager&#34 ;; i:1; s:10:" Supervisor&#34 ;;

我显然只想显示'经理'和主管等。

我怎样才能做到这一点?请记住,我对此完全陌生,我正在学习。

非常感谢任何帮助或建议

0 个答案:

没有答案