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.
| Author |
Topic |
|
cse514
Starting Member
6 Posts |
Posted - 2011-08-17 : 04:37:31
|
| sir,i want to eliminate redundant records in tables.for example i have a table flatrelation having fields course , lady and gentleman. this table is having records of this type shown belowCOURSE LADY GENTLEMANswing x raajswing y raajthis table contains this sort of records and normal distinct records.my intention is to eliminate redundacy by doing some processing on the base table i.e flatrelation and converting it asCOURSE LADY GENTLEMANswing x,y raajthat is by making lady as nested.my sample table isflatrelationCOURSE LADY GENTLEMANswing x raajviolin abc saiswing y raajveena xyz ramuviolin ccc saiand my required format isnestedoverladyCOURSE LADY GENTLEMANswing x,y raajviolin abc,ccc saiveena xyz ramusir the following one is the reply which was posted but i am getting an error "missing right parenthesis" while i am working with in 10g.. INSERT INTO nestedlady(COURSE, LADY, GENTLEMAN)SELECT f.COURSE,STUFF((SELECT ',' + LADYFROM flatrelationWHERE COURSE = f.COURSEAND GENTLEMAN = f.GENTLEMANORDER BY LADY ASCFOR XML PATH('')),1,1,''),f.GENTLEMANFROM (SELECT DISTINCT COURSE,GENTLEMAN FROM flatrelation)fthis is the query i used and i am getting an error missing right paranthesis .. i can't understand the reason for that please please suggest a solution as early as possible.. i am working for an idea but unfortunately strucked here.My progress is hindered due to this. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-17 : 04:47:45
|
quote: Originally posted by cse514 sir,i want to eliminate redundant records in tables.for example i have a table flatrelation having fields course , lady and gentleman. this table is having records of this type shown belowCOURSE LADY GENTLEMANswing x raajswing y raajthis table contains this sort of records and normal distinct records.my intention is to eliminate redundacy by doing some processing on the base table i.e flatrelation and converting it asCOURSE LADY GENTLEMANswing x,y raajthat is by making lady as nested.my sample table isflatrelationCOURSE LADY GENTLEMANswing x raajviolin abc saiswing y raajveena xyz ramuviolin ccc saiand my required format isnestedoverladyCOURSE LADY GENTLEMANswing x,y raajviolin abc,ccc saiveena xyz ramusir the following one is the reply which was posted but i am getting an error "missing right parenthesis" while i am working with in 10g.. INSERT INTO nestedlady(COURSE, LADY, GENTLEMAN)SELECT f.COURSE,STUFF((SELECT ',' + LADYFROM flatrelationWHERE COURSE = f.COURSEAND GENTLEMAN = f.GENTLEMANORDER BY LADY ASCFOR XML PATH('')),1,1,''),f.GENTLEMANFROM (SELECT DISTINCT COURSE,GENTLEMAN FROM flatrelation)fthis is the query i used and i am getting an error missing right paranthesis .. i can't understand the reason for that please please suggest a solution as early as possible.. i am working for an idea but unfortunately strucked here.My progress is hindered due to this.
So thats it. you're using ORACLEthis is a SQL Server forum and solutions given here are mostly specific to MS SQL Server.If you need more help on oracle please try your luck atwww.orafaq.com or www.dbforums.com------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|