jeudi 23 juillet 2015

Alias Logic in Sql Server 2005

I have always find problem while using alias. Actually I want to use table alias that means a complex type of alias. I am not sure if my requirement is right or I am doing in the right way it is suppose to but yet if you can clear my doubts on how we can select something using alias on a query would be much appreciated. Please ignore my english language.

This is the Query

select * from TBL where lng_TaskId not in (select lng_TaskId from Mask_Tasks MT inner join Mask_TaskCategories MC on
MT.lng_TaskCatID = MC.lng_taskCatid and MT.lng_MajEqId = MC.lng_MajEqId)TBL

So, I have a sub query which will run first to give me some ID's. Now I want to use it an alias and then want to select from this alias in my outer or main query. Can you please explain how to use alias in this way or any other better way to use an alias in SQL server. I will really be thankful to you.

Aucun commentaire:

Enregistrer un commentaire