Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 T-SQL for status specifice selection

Author  Topic 

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2008-06-23 : 03:20:50
I have a result set that displays
applicationID, StepID(foreing key of StatusMaster)

i have 10 statusId in total and each applicationID has to aaume all status for next proceesing level.Now,i have no proity level for status.Also the status may assume non sequential statusID.

Noted that this table have ideally 10 unique application ID corresponding to 10 all different status.

Now i have to find those applicationID where applicationID has assumed 6th step but not 8th one irrespective of other status information of applicationID.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-06-23 : 03:32:29
OK. somebody get me some acetylsalicylic acid

1. Post your table Structure (DDL)
2. Some Sample data in the forms of insert into table . . .
3. Show us the result that you want with the sample data in (2)


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-23 : 03:39:03
May be this

SELECT ApplicationID
FROM YourTable
GROUP BY ApplicationID
HAVING SUM(CASE WHEN StepID=8 THEN 1 ELSE 0 END)= 0
AND SUM(CASE WHEN StepID=6 THEN 1 ELSE 0 END)= 1



If this is not what you're looking for please post the details as suggested by Khtan to get more help
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-23 : 03:41:27
http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-06-23 : 03:42:41
quote:
Originally posted by Peso

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx



E 12°55'05.25"
N 56°04'39.16"




Good link


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-23 : 03:44:31
That's right. You have been away for a while.
Jeff took time to write the article.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -