Ranga_The_Donga Posted July 25, 2012 Report Posted July 25, 2012 [quote name='chandrabhai6' timestamp='1343253202' post='1302200304'] Wrong [/quote] agree.. athanidhi indaka version correst....
chandrabhai6 Posted July 25, 2012 Report Posted July 25, 2012 [quote name='arey ooo samba' timestamp='1343253273' post='1302200317'] basically in my col3 I need to know how many times the value of col2 is repeated in the entire table baa [/quote] Try the one I gave and lemme know
jaffanajeffada Posted July 25, 2012 Report Posted July 25, 2012 [quote name='arey ooo samba' timestamp='1343253273' post='1302200317'] basically in my col3 I need to know how many times the value of col2 is repeated in the entire table baa [/quote] do you want to show col1 too??
Vaampire Posted July 25, 2012 Report Posted July 25, 2012 naaku ippati varaku col3 endo ardham kaledhu. what exactly u mean by [color=#282828][font=helvetica, arial, sans-serif]aggregation of col2???[/font][/color]
ghazni Posted July 25, 2012 Report Posted July 25, 2012 babu idi t-sql leka oracle aa...... aa code chustey oracle ani na doubt..... plz clarify.....
qwerty1204 Posted July 25, 2012 Author Report Posted July 25, 2012 [quote name='chandrabhai6' timestamp='1343252895' post='1302200258'] Select col1 , col2, (select count(1) from tableX A where A.col2=B.col2 group by col2) From TableX B [/quote] rendu tables levu baa..okatee ga undi TableX A and TableX B enti
jaffanajeffada Posted July 25, 2012 Report Posted July 25, 2012 [quote name='Vaampire' timestamp='1343253394' post='1302200340'] naaku ippati varaku col3 endo ardham kaledhu. what exactly u mean by [color=#282828][font=helvetica, arial, sans-serif]aggregation of col2???[/font][/color] [/quote] no. of repetitions ani dhaani meaning, i guess
jaffanajeffada Posted July 25, 2012 Report Posted July 25, 2012 [quote name='arey ooo samba' timestamp='1343253430' post='1302200345'] rendu tables levu baa..okatee ga undi TableX A and TableX B enti [/quote] nenu ichina SQL oka sari try chey baa, work avvudhi ani anukuntunna
Ranga_The_Donga Posted July 25, 2012 Report Posted July 25, 2012 [quote name='arey ooo samba' timestamp='1343253430' post='1302200345'] rendu tables levu baa..okatee ga undi TableX A and TableX B enti [/quote] same table e.. A and B rename chesadu...
innovative Posted July 25, 2012 Report Posted July 25, 2012 [quote name='jaffanajeffada' timestamp='1343253011' post='1302200273'] ila try chey, not sure select distinct a.col1, a.col2, b.col3 from table1 a, (select col2, count(*) as col3 from table1 group by col2) b where a.col2= b.col2 [/quote] This one is correct .
Vaampire Posted July 25, 2012 Report Posted July 25, 2012 select TABLEA.col1,TABa.col2,col3 from TABa inner join (select col2, count(col2) as col3 from TABa group by col2)temp on temp.col2=TABLEA.col2
qwerty1204 Posted July 25, 2012 Author Report Posted July 25, 2012 [quote name='jaffanajeffada' timestamp='1343253335' post='1302200333'] do you want to show col1 too?? [/quote] yes..I need col1 also baa [quote name='Vaampire' timestamp='1343253394' post='1302200340'] naaku ippati varaku col3 endo ardham kaledhu. what exactly u mean by [color=#282828][font=helvetica, arial, sans-serif]aggregation of col2???[/font][/color] [/quote] col2 aggregation ante...col2 lo "abc" 2 times repeat ayyindi kada baa entire table loo...so col3 lo value 2 ani ravali for row1 and row3 but for row2 lo "xyz" ani oka sare undi kada overall table loo andhukee col3 lo dani value 1 ani ravali[quote name='ghazni' timestamp='1343253408' post='1302200342'] babu idi t-sql leka oracle aa...... aa code chustey oracle ani na doubt..... plz clarify..... [/quote] I am dng it in DB2 baa
jaffanajeffada Posted July 25, 2012 Report Posted July 25, 2012 [quote name='arey ooo samba' timestamp='1343253591' post='1302200372'] yes..I need col1 also baa col2 aggregation ante...col2 lo "abc" 2 times repeat ayyindi kada baa entire table loo...so col3 lo value 2 ani ravali for row1 and row3 but for row2 lo "xyz" ani oka sare undi kada overall table loo andhukee col3 lo dani value 1 ani ravali I am dng it in DB2 baa [/quote] try like this [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]select distinct a.col1, a.col2, b.col3 from table1 a,[/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)](select col2, count(*) as col3 from table1[/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]group by col2) b[/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]where a.col2= b.col2[/background][/size][/font][/color]
ghazni Posted July 25, 2012 Report Posted July 25, 2012 [quote name='arey ooo samba' timestamp='1343253591' post='1302200372'] I am dng it in DB2 baa [/quote] ohh avna ......
chandrabhai6 Posted July 25, 2012 Report Posted July 25, 2012 [quote name='arey ooo samba' timestamp='1343253430' post='1302200345'] rendu tables levu baa..okatee ga undi TableX A and TableX B enti [/quote] Alias bayya same table name meeda 2 aliases Try Chey working [img]http://www.gifsoup.com/view1/1444039/brahmi-hug-o.gif[/img]
Recommended Posts