| Author |
Message |
   
Chasing_perfection
Junior Artist Username: Chasing_perfection
Post Number: 49 Registered: 04-2009 Posted From: 75.189.149.195
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 09:27 pm: |
    |
Gotcha:
yeah...first example chusthe konchem idea vachindi... |
   
Gotcha
Side Hero Username: Gotcha
Post Number: 4017 Registered: 02-2008 Posted From: 98.206.204.119
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 09:22 pm: |
    |
Chasing_perfection:
yeah. simple group by to ayopyedi if the other column is just some aggregate like max, min, sum, count etc but its not aggreagate so the issue. |
   
Chasing_perfection
Junior Artist Username: Chasing_perfection
Post Number: 48 Registered: 04-2009 Posted From: 75.189.149.195
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 09:20 pm: |
    |
Gotcha:
ento simple group by tho ayipothundhi anukunnna...kani intha vuntundhi anukole... |
   
Gotcha
Side Hero Username: Gotcha
Post Number: 4014 Registered: 02-2008 Posted From: 98.206.204.119
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 09:11 pm: |
    |
Chasing_perfection:
nuvvu ichindi very correct link. it will surely help driver ramudu anukuntuna, chala methods ichadu aa link lo. |
   
Chasing_perfection
Junior Artist Username: Chasing_perfection
Post Number: 46 Registered: 04-2009 Posted From: 75.189.149.195
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 09:00 pm: |
    |
Gotcha:
emo anna ...naku ayithe okka mukka ardam kaledhu kani koncem similar scenario anipinchi ichanu... |
   
Gotcha
Side Hero Username: Gotcha
Post Number: 4013 Registered: 02-2008 Posted From: 98.206.204.119
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 08:56 pm: |
    |
Chasing_perfection:
this is what i was saying by using cross apply. The blackbox XML methods Here is a technique for string concatenation that uses the FOR XML clause with PATH mode. It was initially posted by Eugene Kogan, and later became common in public newsgroups. SELECT p1.CategoryId, ( SELECT ProductName + ',' FROM Northwind.dbo.Products p2 WHERE p2.CategoryId = p1.CategoryId ORDER BY ProductName FOR XML PATH('') ) AS Products FROM Northwind.dbo.Products p1 GROUP BY CategoryId ; There is a similar approach that was originally found in the beta newsgroups, using the CROSS APPLY operator. SELECT DISTINCT CategoryId, ProductNames FROM Northwind.dbo.Products p1 CROSS APPLY ( SELECT ProductName + ',' FROM Northwind.dbo.Products p2 WHERE p2.CategoryId = p1.CategoryId ORDER BY ProductName FOR XML PATH('') ) D ( ProductNames ) You may notice a comma at the end of the concatenated string, which you can remove using a STUFF, SUBSTRING or LEFT function. While the above methods are deemed reliable by many at the time of writing, there is no guarantee that it will stay that way, given that the internal workings and evaluation rules of FOR XML PATH() expression in correlated subqueries are not well documented. |
   
Chasing_perfection
Junior Artist Username: Chasing_perfection
Post Number: 45 Registered: 04-2009 Posted From: 75.189.149.195
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 08:53 pm: |
    |
Driverramudu:
http://www.simple-talk.com/sql/t-sql-programming/concatenati ng-row-values-in-transact-sql/ anna...hope this helps...I am not sure though |
   
Gotcha
Side Hero Username: Gotcha
Post Number: 4010 Registered: 02-2008 Posted From: 98.206.204.119
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 08:20 pm: |
    |
actually there is a method in sql 2k5 for the reverse of it called cross over. what ur looking for is opposite of cross over. my guess scalar is he only way. |
   
Gotcha
Side Hero Username: Gotcha
Post Number: 4009 Registered: 02-2008 Posted From: 98.206.204.119
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 08:19 pm: |
    |
use group by and then use a scalar function to combine. it wont take 2 minutes ur logic must be wrong somehwere. |
   
Driverramudu
Comedian Username: Driverramudu
Post Number: 1897 Registered: 02-2009 Posted From: 166.205.134.8
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 08:07 pm: |
    |
Gotcha:
i tried but prob with pivot is we have to hardcode section names which i dont want. Also it is meant for showing columns as rows and row values as column names Driving is my PASSION. Ball or Bmmer does not matter |
   
Gotcha
Side Hero Username: Gotcha
Post Number: 4008 Registered: 02-2008 Posted From: 98.206.204.119
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 08:03 pm: |
    |
try to use SQL PIVOT its easy and its a new feature of sql 2k5 |
   
Driverramudu
Comedian Username: Driverramudu
Post Number: 1896 Registered: 02-2009 Posted From: 166.205.134.8
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:55 pm: |
    |
Wrathchild:
yep i trief many ways like using outer apply and partiion clauses some how related section names are not concatenetef with comma Driving is my PASSION. Ball or Bmmer does not matter |
   
Wrathchild
Side Hero Username: Wrathchild
Post Number: 8488 Registered: 03-2009 Posted From: 69.136.172.251
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:46 pm: |
    |
Driverramudu:
SQL SERVER lo partition by clause etc support unda? |
   
Driverramudu
Comedian Username: Driverramudu
Post Number: 1895 Registered: 02-2009 Posted From: 166.205.132.112
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:44 pm: |
    |
Wrathchild:
here we r using sql server 2K5 we r not allowed to use those technologies as its not feasble to do Driving is my PASSION. Ball or Bmmer does not matter |
   
Wrathchild
Side Hero Username: Wrathchild
Post Number: 8487 Registered: 03-2009 Posted From: 69.136.172.251
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:40 pm: |
    |
Driverramudu:
deeniki best approach..table ni flat file ki dump kotti perl/awk lo script raste super fast aipotundi..let me check..i used this before in perl/awk |
   
Wrathchild
Side Hero Username: Wrathchild
Post Number: 8486 Registered: 03-2009 Posted From: 69.136.172.251
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:39 pm: |
    |
Driverramudu:section no. Name 11. Aa 11. Bb 11. Cc 22. Dd 22. Ee 22. Ff finally output should be sectionno. Names 11. Aa,bb,cc 22. Dd,ee,ff
ee req ki nuvvu phrase chesina question ki asalu connection unda |
   
Driverramudu
Comedian Username: Driverramudu
Post Number: 1894 Registered: 02-2009 Posted From: 166.205.132.112
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:38 pm: |
    |
Also i neither wann use cursor nor procedural aproach i just wann write logic in just query. I.e. Relational approach xample data section no. Name 11. Aa 11. Bb 11. Cc 22. Dd 22. Ee 22. Ff finally output should be sectionno. Names 11. Aa,bb,cc 22. Dd,ee,ff note here rows are not fixed if more sections avail then output also increases accordingly Driving is my PASSION. Ball or Bmmer does not matter |
   
Wrathchild
Side Hero Username: Wrathchild
Post Number: 8485 Registered: 03-2009 Posted From: 69.136.172.251
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:35 pm: |
    |
clear ga ledu nee question..order by section number kottachuga |
   
Driverramudu
Comedian Username: Driverramudu
Post Number: 1893 Registered: 02-2009 Posted From: 166.205.132.112
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:28 pm: |
    |
Using scalar function i wrote query but its taking 2minuted 30seconds to return 540K + rows. My objective is max 5 seconds as of now Driving is my PASSION. Ball or Bmmer does not matter |
   
Driverramudu
Comedian Username: Driverramudu
Post Number: 1892 Registered: 02-2009 Posted From: 166.205.132.112
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, September 10, 2009 - 07:24 pm: |
    |
I got a table and it is having 2 columns. They are Section no and studentname. Now the requirement is i wann display all the student names under each section without using scalar function. This is must Driving is my PASSION. Ball or Bmmer does not matter |