vikuba Posted October 31, 2012 Report Posted October 31, 2012 oka query raasaanu...daani format ila undhi.. with A1 as ( select a ), A2 as ( select b ), A3 as ( select c ) select a from A1 union select b from A2 union select c from A3 will give me a set of results.. what I want do is now to join another table to the whole union part ekkada bracket open cheyali...ekada close cheyaali..emani naming ivaali.. please suggest..any sort or any kind of modification as long as it works...it ROCKS
chelsea Posted October 31, 2012 Report Posted October 31, 2012 [quote name='Aamphat' timestamp='1351709675' post='1302718238'] oka query raasaanu...daani format ila undhi.. will give me a set of results.. what I want do is now to join another table to the whole union part ekkada bracket open cheyali...ekada close cheyaali..emani naming ivaali.. please suggest..any sort or any kind of modification as long as it works...it ROCKS [/quote] U can try this way Select ( with A1 as ( select a ), A2 as ( select b ), A3 as ( select c ) select a from A1 union select b from A2 union select c from A3 ) as Y inner join Table X on
vikuba Posted October 31, 2012 Author Report Posted October 31, 2012 THANKS CHELSEA for suggestion...i think that works too... didnt test it yet
vikuba Posted October 31, 2012 Author Report Posted October 31, 2012 GOT THE ANSWER... for my requirement i would have to do [color=#282828][font=helvetica, arial, sans-serif]with[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]A1 as[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]([/font][/color] [color=#282828][font=helvetica, arial, sans-serif]select a[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]),[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]A2 as[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]([/font][/color] [color=#282828][font=helvetica, arial, sans-serif]select b[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]),[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]A3 as[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]([/font][/color] [color=#282828][font=helvetica, arial, sans-serif]select c[/font][/color] [color=#282828][font=helvetica, arial, sans-serif])[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]select AX.AA from [/font][/color] [color=#282828][font=helvetica, arial, sans-serif]([/font][/color] [color=#282828][font=helvetica, arial, sans-serif]select a as AAfrom A1[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]union[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]select b as AA from A2[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]union[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]select c as AA from A3[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]) AX [/font][/color]
chelsea Posted October 31, 2012 Report Posted October 31, 2012 [quote name='Aamphat' timestamp='1351710092' post='1302718303'] THANKS CHELSEA [/quote] bhayya chudu nuvu CTE use chesthunnavu kada Work avthunado ledo Test cheyyi
vikuba Posted October 31, 2012 Author Report Posted October 31, 2012 [quote name='chelsea' timestamp='1351710051' post='1302718293'] U can try this way Select ( with A1 as ( select a ), A2 as ( select b ), A3 as ( select c ) select a from A1 union select b from A2 union select c from A3 ) as Y inner join Table X on [/quote] idhi work kaadhu mama... naaku kavalsindhi nen union part nunchi techestuna... so union part nunchi inko bracket open chesi and part ni matramey rename chesthey we can retrieve wat we want from tht part. adhey mothaaniki nuvu annattu bracket petti malli as Y and join antey... motham runn ayi...konni extra bracketlu open chesi..adhi malli malli run ayi...slow avthadi..
Recommended Posts