.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

SQL Help

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :Sql Server
Hi All, I've got a table, called WorkPack - This has the following columns: WoPa_ID (int), Appr_ID (int), WoPa_Ref (int), WoPa_Title (varchar), WoPa_Revision (decimal) If a new revision is added to a work pack, then a new record is still added, thus, you can have multiple of the same work pack - the only difference being it's ID and the Revision. I want to run a script that will give me the following: Appr_ID, WoPa_Ref, WoPa_Title, Rev01, Rev02, Rev03, Rev04, Rev10   Rev01-Rev10 should represent whether or not there was a match for that revision. For example - If I have the following records... WoPa_ID | Appr_ID | WoPa_Ref | WoPa_Title | WoPa_Revision 1 | 1 | 1 | This is a title | 0.1 2 | 1 | 1 | This is a title | 0.2 3 | 1 | 1 | This is a title | 0.3 I want the following to be displayed 1 | 1 | This is a Title | 1 | 1 | 1 | 0 | 0 = Showing that this work pack has revisions 0.1, 0.2, 0.3 and NOT 0.4 or 1.0 I hope this makes sense - I know this is probably the worst explanation for what I want but I don't know how else to explain it! Thanks in advance. I've tried the following, but the results weren't distinct like I wanted:   SELECT x.Appr_ID, x.WoPa_Ref, x.WoPa_Title, CASE WHEN y.WoPa_Revision = 0.1 THEN WoPa_Revision ELSE 0.0 END As Rev01, CASE WHEN y.WoPa_Revision = 0.2 THEN WoPa_Revision ELSE 0.0 END As Rev02, CASE WHEN

View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend