21 個の同一の列名を持つ 2 つのテーブルがありますが、データは異なります。テーブルを結合したいのですが、両方の列 (row["phase1"]、row["other_phase1"]) にアクセスします。
SELECT t_process.*,t_task_process.* AS other_column WHERE ...
21列すべてにASステートメントを書く必要がありますか、それとも簡潔な方法がありますか? そうでない場合、次のキーを持つ配列として結果を取得する方法はありません: t_process.phase1 、 .... 、 t_task_process.phase1 、 ... ?
また、データベースで名前を変更できません。
元のクエリは次のとおりです。
SELECT t_process.*,t_task_process.*
FROM t_process,t_task_process
WHERE t_process.id = t_task_process.id
AND (t_process.phase1<>t_task_process.phase1
OR t_process.phase2<>t_task_process.phase2
OR t_process.phase3<>t_task_process.phase3
OR t_process.phase4<>t_task_process.phase4
OR t_process.phase5<>t_task_process.phase5
OR t_process.phase6<>t_task_process.phase6
OR t_process.phase7<>t_task_process.phase7
OR t_process.phase8<>t_task_process.phase8
OR t_process.phase9<>t_task_process.phase9
OR t_process.phase19<>t_task_process.phase10
OR t_process.phase11<>t_task_process.phase11
OR t_process.phase12<>t_task_process.phase12
OR t_process.phase13<>t_task_process.phase13
OR t_process.phase14<>t_task_process.phase14
OR t_process.phase15<>t_task_process.phase15
OR t_process.phase16<>t_task_process.phase16
OR t_process.phase17<>t_task_process.phase17
OR t_process.phase18<>t_task_process.phase18
OR t_process.phase19<>t_task_process.phase19
OR t_process.phase20<>t_task_process.phase20
OR t_process.phase21<>t_task_process.phase21)
mysql が私が望むものを持っているという強制はありません。簡潔な方法があるかどうか知りたいだけです。