範例table:Mysql的前綴自動添加到域
id | field1 | field2
--------------------
表2:
id | id1 | field1 | field2
--------------------------
是否有可能做到這一點:
select t1.*, t2.* from table1 t1 inner join table2 t2 on t1.id = t2.id1
和接受這樣的結果:
t1_id | t1_fiedl1 | t1_field2 | t2_id | t2_id1 | t2_fiedl1 | t2_field2
----------------------------------------------------------------------
我們的目標是使MySQL自動添加前綴導致領域,避免長時間分型,如
select t1.id as t1_id, t1.field1 as t1_field1
等
你試過了嗎? – hims056
您可以得到標題,我不確定數據,請提供示例數據並說明您的期望 –
我總是在字段名稱的前面加上所有表格的表名稱的描述性三字縮寫。 –