I am joining two tables house and tower, both have some of the same column names such as id, created_at, deleted, address etc. I wonder if it is possible to return the columns in the following fashion: house.created_at, house.id, tower.created_at, tower.id etc. I know I can query with AS, I was wondering if it is possible to query something like this: SELECT house.* AS house, tower.* AS tower. I tried it like this, but it was not valid SQL. Any idea how I can chase the column names prefix easily ?
-
No, that's not possible. You have to write the alias for each column individuallyuser330315– user3303152018-10-19 20:33:02 +00:00Commented Oct 19, 2018 at 20:33
-
2See here: stackoverflow.com/q/5179648/330315user330315– user3303152018-10-19 20:35:54 +00:00Commented Oct 19, 2018 at 20:35
-
Why isn't using the table alias in the select list sufficient?Mureinik– Mureinik2018-10-19 20:36:23 +00:00Commented Oct 19, 2018 at 20:36
Add a comment
|