Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 tsql code Rate Topic Display Mode Topic Options
Author
 Message
 Posted Friday, July 6, 2012 10:12 PM
 Forum Newbie Group: General Forum Members Last Login: Tuesday, January 22, 2013 9:00 PM Points: 2, Visits: 18
 Imagine a table which contains records for all weekly number of bugsdiscovered by each QA analysts in the team for one year. Please describe asimple SQL statement for identifying a winner (an employee who found thebiggest number of bugs during that year) by writing one statement?
Post #1326381
 Posted Saturday, July 7, 2012 1:36 AM
 Ten Centuries Group: General Forum Members Last Login: Today @ 8:52 AM Points: 1,149, Visits: 9,646
 debris_flow (7/6/2012)Imagine a table which contains records for all weekly number of bugsdiscovered by each QA analysts in the team for one year. Please describe asimple SQL statement for identifying a winner (an employee who found thebiggest number of bugs during that year) by writing one statement?This is a simple exercise made difficult by having to imagine what the table and data look like. Read the link in my sig "please read this" and provide DDL for the table and DML for some sample data. Otherwise you may have to imagine what the simple SQL statement might look like Low-hanging fruit picker and defender of the moggies For better assistance in answering your questions, please read this. Understanding and using APPLY, (I) and (II) Paul White Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Post #1326397
 Posted Saturday, July 7, 2012 7:31 AM
 Forum Newbie Group: General Forum Members Last Login: Tuesday, January 22, 2013 9:00 PM Points: 2, Visits: 18
 Thank you very much for your suggestion
Post #1326419
 Posted Saturday, July 7, 2012 1:15 PM
 SSC-Forever Group: General Forum Members Last Login: Today @ 10:25 AM Points: 42,042, Visits: 39,423
 debris_flow (7/6/2012)Imagine a table which contains records for all weekly number of bugsdiscovered by each QA analysts in the team for one year. Please describe asimple SQL statement for identifying a winner (an employee who found thebiggest number of bugs during that year) by writing one statement?This is a terrible homework problem. It doesn't tell you what to do if there's a tie. Some hints to solve this (and there are many different ways). Lookup the following in Books Online.GROUP BYSUM()MAX()ORDER BYCOMMON TABLE EXPRESSIONS (CTEs)RANK()/DENSERANK()ROW_NUMBER() --Jeff Moden"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column." Helpful Links:How to post code problemsHow to post performance problems
Post #1326479

 Permissions