qwerty1204 Posted January 11, 2013 Report Posted January 11, 2013 I need to write a query like this TABLE1 is having a column named TABLE1_COL1 TABLE2 is having a column named TABLE2_COL1 SELECT TABLE1_COL1 AS OUTPUT_COL1 [b],(SELECT TABLE2_COL1, Count(*) FROM TABLE2 GROUP BY TABLE2_COL1) AS OUTPUT_COL2[/b] FROM TABLE1 aa bold chesina query loo AS OUTPUT_COL2 lo ki nenu count(*) value nee rayalii adhi elaa
150bryant Posted January 11, 2013 Report Posted January 11, 2013 table1 table 2 join chesi...group by cheyi.. if there is no relation between the tables...u cannot handle any operations 1
iTeachSAP Posted January 11, 2013 Report Posted January 11, 2013 SELECT TABLE1_COL1 AS TABLE.OUTPUT_COL1[b],[/b]TABLE2.COL2 FROM TABLE1,[b](SELECT TABLE2_COL1, Count(*) AS COL2 FROM TABLE2 GROUP BY TABLE2_COL1) AS TABLE2[/b] [b]WHERE TABLE1.COLUMN1=TABLE.[/b][b]COL2 [/b] idhi raasukooo pandaga chesukoo
qwerty1204 Posted January 11, 2013 Author Report Posted January 11, 2013 [quote name='jamajacha' timestamp='1357932151' post='1303093156'] table1 table 2 join chesi...group by cheyi.. if there is no relation between the tables...u cannot handle any operations [/quote] what if I want to retirve additional columns from table1? group by chesthe...aa group by loo unna column's nee kada select lo kuda rayalisindi...extra columns rasthe wrk avadau kada baa?
lraja2000 Posted January 11, 2013 Report Posted January 11, 2013 [color=#282828][font=helvetica, arial, sans-serif]SELECT[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]TABLE1_COL1 AS OUTPUT_COL1[/font][/color] [b],(SELECT Count(*) FROM TABLE2 GROUP BY TABLE2_COL1) AS OUTPUT_COL2[/b] [color=#282828][font=helvetica, arial, sans-serif]FROM[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]TABLE1[/font][/color]
loveindia Posted January 11, 2013 Report Posted January 11, 2013 [quote name='arey ooo samba' timestamp='1357931952' post='1303093111'] I need to write a query like this TABLE1 is having a column named TABLE1_COL1 TABLE2 is having a column named TABLE2_COL1 SELECT TABLE1_COL1 AS OUTPUT_COL1 [b],(SELECT TABLE2_COL1, Count(*) FROM TABLE2 GROUP BY TABLE2_COL1) AS OUTPUT_COL2[/b] FROM TABLE1 aa bold chesina query loo AS OUTPUT_COL2 lo ki nenu count(*) value nee rayalii adhi elaa [/quote] inkonchem extra DDL post cheydaniki try chey.. or else oka test table type lo anna try chey.. easy ga help vastundi because it will be more understandable, than what you wrote..
qwerty1204 Posted January 11, 2013 Author Report Posted January 11, 2013 [quote name='iTeachSAP' timestamp='1357932323' post='1303093195'] SELECT TABLE1_COL1 AS TABLE.OUTPUT_COL1[b],[/b]TABLE2.COL2 FROM TABLE1,[b](SELECT TABLE2_COL1, Count(*) AS COL2 FROM TABLE2 GROUP BY TABLE2_COL1) AS TABLE2[/b] [b]WHERE TABLE1.COLUMN1=TABLE.[/b][b]COL2 [/b] idhi raasukooo pandaga chesukoo [/quote] ila try chesanu baa earlier..extra rows are cmng in the output andhukee select lo nee rayadaniki chustunnaa
qwerty1204 Posted January 11, 2013 Author Report Posted January 11, 2013 [quote name='iTeachSAP' timestamp='1357932323' post='1303093195'] SELECT TABLE1_COL1 AS TABLE.OUTPUT_COL1[b],[/b]TABLE2.COL2 FROM TABLE1,[b](SELECT TABLE2_COL1, Count(*) AS COL2 FROM TABLE2 GROUP BY TABLE2_COL1) AS TABLE2[/b] [b]WHERE TABLE1.COLUMN1=TABLE.[/b][b]COL2 [/b] idhi raasukooo pandaga chesukoo [/quote] ila try chesanu baa earlier..extra rows are cmng in the output andhukee select lo nee rayadaniki chustunnaa
iTeachSAP Posted January 11, 2013 Report Posted January 11, 2013 [quote name='arey ooo samba' timestamp='1357935003' post='1303093631'] ila try chesanu baa earlier..extra rows are cmng in the output andhukee select lo nee rayadaniki chustunnaa [/quote] Extra rows vasthunayi ante.. you are not supplying proper join to the query .. add some more conditions to the query..
mtkr Posted January 11, 2013 Report Posted January 11, 2013 table1_col1 and table2_col1 column names same aa mama r diff a???
qwerty1204 Posted January 11, 2013 Author Report Posted January 11, 2013 [quote name='iTeachSAP' timestamp='1357935670' post='1303093729'] Extra rows vasthunayi ante.. you are not supplying proper join to the query .. add some more conditions to the query.. [/quote] you are right bhayya..my actual scenario loo joining 4 tables involved lee...joining condition lo modify chesthe it worked
qwerty1204 Posted January 11, 2013 Author Report Posted January 11, 2013 [quote name='mtkr' timestamp='1357939277' post='1303094272'] table1_col1 and table2_col1 column names same aa mama r diff a??? [/quote] different le bhayaa..actual ga there is a joining column between those two tables..nenu edhoo simplier example tho explain chesaa ee in my question
pikki Posted January 11, 2013 Report Posted January 11, 2013 LTT [img]http://i.imgflip.com/9yc6.gif[/img]
qwerty1204 Posted January 11, 2013 Author Report Posted January 11, 2013 [quote name='pikki' timestamp='1357944346' post='1303094803'] LTT [img]http://i.imgflip.com/9yc6.gif[/img] [/quote] issue solved lee baa [img]http://i.imgflip.com/9yc6.gif[/img]
pikki Posted January 11, 2013 Report Posted January 11, 2013 [quote name='arey ooo samba' timestamp='1357944707' post='1303094827'] issue solved lee baa [img]http://i.imgflip.com/9yc6.gif[/img] [/quote] 0k...[img]http://lh6.ggpht.com/-ocaK3uCxuCM/UN-wslzshzI/AAAAAAAAIbw/P2s7nway6Ok/s150/NTR-4.gif[/img]
Recommended Posts