Deviprasad Das Deviprasad Das - 1 year ago 61
SQL Question

Multiple Alias names for a table

Can we have multiple alias names for a single table?

Answer Source

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]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download