I have a select with a join.
I know that I can do this:
table1.id as table1_id, table1.name as table1_name
I was wondering if it’s possible to do it automatically when selecting fields in this way:
table1.*
I completely understand that this is bad practice, but it’s useful for local testing and I was wondering if it was possible to do something like this.
Thank you very much.
I would recommend adding some additional context to your id and name field names (for example, if you had tables Person and Employer you might use person_id and employer_id as the field names).
In lieu of changing your table structure, I don’t think you can automatically prepend your table names to the fields you could select. But, you could create a view for your query, then in your application, select from the view. Consider this example: