MySQL表.* AS参考 [英] MySQL table.* AS reference
本文介绍了MySQL表.* AS参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在MySQL中使用联接,我想在所有表列之间做出明确区分,例如:
I'm using joins in MySQL and I would like to make a clear distinction between all the table columns like:
SELECT table.* AS table_reference, table2.* AS table2_reference ...
SELECT table.* AS table_reference, table2.* AS table2_reference ...
具有这样的结果:
- table.id
- table.title
- table2.id
- table2.title
有可能吗?
推荐答案
您必须为每个列赋予自己的别名:
You have to do it by giving each column its own alias:
select table.id as table_id, table.title as table_title,
table2.id as table2_id, table2.title as table2_title
from . . .
这篇关于MySQL表.* AS参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文