Jump to content

Calling Database Guru's


Recommended Posts

Posted

WITH cte_name (col1, col2,...)
AS
(
SELECT col1, col2...
FROM Table1
JOIN Table2
blah blah
)

Now, do whatever you want with that cte

SELECT x,y,z
FROM cte_name ct1
JOIN cte_name ct1 -- self referencing adv that I told - you can also join with another table
WHERE ....
Group by...

Once the above line is executed then cte_name will no longer be available( performance wise chala better)

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

  • Silver_mani

    30

  • mtkr

    15

  • ChampakDas

    10

  • siri_vennela

    5

Popular Days

Top Posters In This Topic

Posted

New to db. What is LTT? (!(<
[quote name='Silver_mani' timestamp='1339565438' post='1301960056']
ltt for ChampakDas [img]http://lh5.ggpht.com/-ux6UiZkZOaQ/T7UzwDXHbZI/AAAAAAAAGeA/BY_osPDS4-Q/s150/Brahmi-1.gif[/img]
[/quote]

Posted

[quote name='ChampakDas' timestamp='1339565548' post='1301960061']
WITH cte_name (col1, col2,...)
AS
(
SELECT col1, col2...
FROM Table1
JOIN Table2
blah blah
)

Now, do whatever you want with that cte

SELECT x,y,z
FROM cte_name ct1
JOIN cte_name ct1 -- self referencing adv that I told - you can also join with another table
WHERE ....
Group by...

Once the above line is executed then cte_name will no longer be available( performance wise chala better)
[/quote]


with command telsu mama ..... CTE ante ade naa [img]http://lh5.ggpht.com/-RFBOKYPt-rQ/T7UzeC77sEI/AAAAAAAAGdc/K35gOpUvDfs/s150/RT-10.gif[/img]

Posted

[quote name='ChampakDas' timestamp='1339565644' post='1301960068']
New to db. What is LTT? (!(<
[/quote]


Lifting the thread ani mama ....to keep this thread active so that other members can view quickly

Posted

ya adhey...with command ani chepalsindha nenu...
[quote name='Silver_mani' timestamp='1339565718' post='1301960071']


with command telsu mama ..... CTE ante ade naa [img]http://lh5.ggpht.com/-RFBOKYPt-rQ/T7UzeC77sEI/AAAAAAAAGdc/K35gOpUvDfs/s150/RT-10.gif[/img]
[/quote]

Posted

got you..
[quote name='Silver_mani' timestamp='1339565777' post='1301960076']


Lifting the thread ani mama ....to keep this thread active so that other members can view quickly
[/quote]

Posted

[quote name='ChampakDas' timestamp='1339565853' post='1301960080']
ya adhey...with command ani chepalsindha nenu...
[/quote]


with[b] CTE[/b]( ) .....ikkada CTE temporary table kadha (the one v create )...correct me if i am wrong

Posted

[quote name='siri_vennela' timestamp='1339566131' post='1301960099']
:3D_Smiles:
[/quote]


rama rama ee taadu lo kuda sfamming aa [img]http://lh5.ggpht.com/-RFBOKYPt-rQ/T7UzeC77sEI/AAAAAAAAGdc/K35gOpUvDfs/s150/RT-10.gif[/img][img]http://lh5.ggpht.com/-RFBOKYPt-rQ/T7UzeC77sEI/AAAAAAAAGdc/K35gOpUvDfs/s150/RT-10.gif[/img]

Posted

[quote name='siri_vennela' timestamp='1339566131' post='1301960099']
:3D_Smiles:
[/quote]

i posted a thread for u and u never reply I Hate You

Posted

Yes but not completely correct. Temporary tables ante which exists in that instance (which are created by #tablename) but CTE's are somewhat different in the sense that they can be used only in one query where as temporary tables can be used in current instance.
[quote name='Silver_mani' timestamp='1339566008' post='1301960090']


with[b] CTE[/b]( ) .....ikkada CTE temporary table kadha (the one v create )...correct me if i am wrong
[/quote]

Posted

[quote name='Silver_mani' timestamp='1339566176' post='1301960103']


rama rama ee taadu lo kuda sfamming aa [img]http://lh5.ggpht.com/-RFBOKYPt-rQ/T7UzeC77sEI/AAAAAAAAGdc/K35gOpUvDfs/s150/RT-10.gif[/img][img]http://lh5.ggpht.com/-RFBOKYPt-rQ/T7UzeC77sEI/AAAAAAAAGdc/K35gOpUvDfs/s150/RT-10.gif[/img]
[/quote]

edho chepthunaru anni chusthuna spamming ekkada :3D_Smiles:

Posted

[quote name='ChampakDas' timestamp='1339566242' post='1301960107']
Yes but not completely correct. Temporary tables ante which exists in that instance (which are created by #tablename) but CTE's are somewhat different in the sense that they can be used only in one query where as temporary tables can be used in current instance.
[/quote]


kool mama ...that makes sense ... its wrong to call them temp tables ........ Anyways good post .. thanks CITI_y@R CITI_y@R

Posted

[quote name='siri_vennela' timestamp='1339566351' post='1301960115']

edho chepthunaru anni chusthuna spamming ekkada :3D_Smiles:
[/quote]


kompa deesi nuvu DBA kadu kada :3D_Smiles: :3D_Smiles:

Posted

Cheers mate!!
[quote name='Silver_mani' timestamp='1339566381' post='1301960117']


kool mama ...that makes sense ... its wrong to call them temp tables ........ Anyways good post .. thanks CITI_y@R CITI_y@R
[/quote]

×
×
  • Create New...