0

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 ?

3
  • No, that's not possible. You have to write the alias for each column individually Commented Oct 19, 2018 at 20:33
  • 2
    See here: stackoverflow.com/q/5179648/330315 Commented Oct 19, 2018 at 20:35
  • Why isn't using the table alias in the select list sufficient? Commented Oct 19, 2018 at 20:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.