Deviprasad Das Deviprasad Das - 1 month ago 5x
SQL Question

Multiple Alias names for a table

Can we have multiple alias names for a single table?


Yes. You need to do this for a self join, for example f you have a table storing a hierarchy:

create table Foo (
    FooID int
   ,ParentFooID int

You can do a join to get the children of parents that satisfy a particular condition with a query like:

Select b.*
  from Foo a
  join Foo b
    on a.FooID = b.ParentFooID
   and [some condition filtering a]