Darling999 Posted March 21, 2015 Report Share Posted March 21, 2015 last weekend i had to help a friend in a sql timebound online interview.. dantlo itemid salescount salesdate 1 10 2015-03-20 1 20 2015-02-27 2 5 2015-03-19 ............ ila data untadhi, for a given month print the top 5 items and salescount for that month which are also in the top 5 of the previous month.. Select top 5 Itemid, Salesdate, Sum(Salescount) From Tbl group by Idemid, SalesDate lasst clause ki Having lo agggregate vaadachu ankuntaa, but what is ans? Link to comment Share on other sites More sharing options...
puli_keka Posted March 21, 2015 Report Share Posted March 21, 2015 Select top 5 Itemid, Salesdate, Sum(Salescount) From Tbl group by Idemid, SalesDate lasst clause ki Having lo agggregate vaadachu ankuntaa, but what is ans? dont print everything.. they should be also present in the top 5 of the previous month , MONTH() function vaadochu and -1 cheyochu but january aithe december plus last year , DATEADD DATEPART vaadi raasunde group by simple ga unde i guess, nuvvu sum(salescount) where MONTH(@givenmonth) = MONTH(salesdate) AND DATEPART(yyyy,@givenmonth) = DATEPART(yyyy,salesdate) kuda cheyalsi untadhi Link to comment Share on other sites More sharing options...
Darling999 Posted March 21, 2015 Report Share Posted March 21, 2015 dont print everything.. they should be also present in the top 5 of the previous month , MONTH() function vaadochu and -1 cheyochu but january aithe december plus last year , DATEADD DATEPART vaadi raasunde group by simple ga unde i guess, nuvvu sum(salescount) where MONTH(@givenmonth) = MONTH(salesdate) AND DATEPART(yyyy,@givenmonth) = DATEPART(yyyy,salesdate) kuda cheyalsi untadhi Where lo ivanni ekkadaa Raastaav bhayya? Some other syntax ah sub query raayi I guess Link to comment Share on other sites More sharing options...
Yuvatha Posted March 21, 2015 Report Share Posted March 21, 2015 Where lo ivanni ekkadaa Raastaav bhayya? Some other syntax ah sub query raayi I guess siggunda neeku Link to comment Share on other sites More sharing options...
Darling999 Posted March 21, 2015 Report Share Posted March 21, 2015 siggunda neeku Ledu Assalu eedaa Enduku tirgutaa lekaapoteyy Link to comment Share on other sites More sharing options...
vasu123 Posted March 21, 2015 Report Share Posted March 21, 2015 SSIS ki ela undi market Link to comment Share on other sites More sharing options...
Darling999 Posted March 21, 2015 Report Share Posted March 21, 2015 SSIS ki ela undi marketSsis with Strong SQL ayiteyy $50 that tooo rare reqs more asking on SSAS and cube architects Link to comment Share on other sites More sharing options...
loveindia Posted March 21, 2015 Report Share Posted March 21, 2015 Face to Face interviews kiv ellinappudu... adiginaa SQl ki asn raakapotey best way to face it? Daani related ga edo okati vaagi, I have worked on this topic earlier but on top of my head I am not able to recall it... raakapotey em chestam asalu man.. Link to comment Share on other sites More sharing options...
loveindia Posted March 21, 2015 Report Share Posted March 21, 2015 dont print everything.. they should be also present in the top 5 of the previous month , MONTH() function vaadochu and -1 cheyochu but january aithe december plus last year , DATEADD DATEPART vaadi raasunde group by simple ga unde i guess, nuvvu sum(salescount) where MONTH(@givenmonth) = MONTH(salesdate) AND DATEPART(yyyy,@givenmonth) = DATEPART(yyyy,salesdate) kuda cheyalsi untadhi Man its very easy.. I am assuming you will pass which month you want to see.. there will be two queries.. one main query which calls present month data... One sub query that calls previous months data.. Where you will relate both of them with an exists clause.. if that exists in the top 5 of previous months sub query result it will pull up in this month's main query.. I hope you got it. I am not at a computer so couldn't write the code.. but this is very simple.. just looks for exists operator that's it man.. Link to comment Share on other sites More sharing options...
loveindia Posted March 21, 2015 Report Share Posted March 21, 2015 Ssis with Strong SQL ayiteyy $50 that tooo rare reqs more asking on SSAS and cube architects Cube architect is an awesome job.. full enjoy.. Link to comment Share on other sites More sharing options...
Darling999 Posted March 21, 2015 Report Share Posted March 21, 2015 Daani related ga edo okati vaagi, I have worked on this topic earlier but on top of my head I am not able to recall it... raakapotey em chestam asalu man.. hmmm adey chestunnaa... vaadu mari worst ga rayalsindeyy try cheyyi try cheyyi antaaduu live looo... enthaa expolain chesinaa vinaleduu 85% good interview but aah 15% is bothering me .. lets C Link to comment Share on other sites More sharing options...
Yuvatha Posted March 21, 2015 Report Share Posted March 21, 2015 hmmm adey chestunnaa... vaadu mari worst ga rayalsindeyy try cheyyi try cheyyi antaaduu live looo... enthaa expolain chesinaa vinaleduu 85% good interview but aah 15% is bothering me .. lets C ok allah acha karega Link to comment Share on other sites More sharing options...
mtkr Posted July 30, 2015 Report Share Posted July 30, 2015 :4_12_13: Link to comment Share on other sites More sharing options...
mtkr Posted August 4, 2015 Report Share Posted August 4, 2015 :4_12_13: Link to comment Share on other sites More sharing options...
4Vikram Posted August 4, 2015 Report Share Posted August 4, 2015 :4_12_13: Link to comment Share on other sites More sharing options...
Recommended Posts