SQL help   Independent houses near kukatpally | Apartments in Pragathi Nagar | AndhraVaani.com | Log Out | Topics | Search
Register | Edit Profile

Bewarse Talk � Archives � Cine Talk - Reviews, Gossips, Insider Info etc. � Archive through July 25, 2006 � SQL help � Previous Next �

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Vidhata
Pilla Bewarse
Username: Vidhata

Post Number: 52
Registered: 09-2005
Posted From: 63.87.170.126
Posted on Monday, July 17, 2006 - 5:34 pm:   Edit PostDelete PostView Post/Check IP

babulu ee tokkalo sql server 2000 query lo em tappu chesano cheppandi pls..

select Vendornumber,Currency,sum(invoiceamount) as TotalAmount from approvedinvoices
group by vendornumber,Currency
having vendornumber in @VendorNumber
order by vendornumber, Currency Desc

incorrect syntax near @VendorNumber ani vasondi...

@vendornumber is the input for the StoredProc..
sample value (123,124,125)
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24640
Registered: 07-2004
Posted From: 71.234.232.47
Posted on Monday, July 17, 2006 - 5:29 pm:   Edit PostDelete PostView Post/Check IP

thanx nayak,PT,buff maayyas..

deenthalli repatnunchi ika cube,rollups iragadiyyaali
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

2007
Kurra Bewarse
Username: 2007

Post Number: 678
Registered: 05-2006
Posted From: 129.188.33.222
Posted on Monday, July 17, 2006 - 5:25 pm:   Edit PostDelete PostView Post/Check IP

ounu ala akkarledu anukunta
Top of pagePrevious messageNext messageBottom of page Link to this message

Tmbuff
Pilla Bewarse
Username: Tmbuff

Post Number: 151
Registered: 04-2004
Posted From: 159.153.4.51
Posted on Monday, July 17, 2006 - 5:24 pm:   Edit PostDelete PostView Post/Check IP

I haven't tried the SQL penukonda mama gave, but it is a overkill for the requirement I think.
Top of pagePrevious messageNext messageBottom of page Link to this message

2007
Kurra Bewarse
Username: 2007

Post Number: 677
Registered: 05-2006
Posted From: 129.188.33.222
Posted on Monday, July 17, 2006 - 5:23 pm:   Edit PostDelete PostView Post/Check IP

denne

select col1, col2, sum(amt)
group by CUBE(col1, col2) ante

results ila vundiddi
India AP 300
NULL AP 300
India UP 500
NULL UP 500
India MP 1000
NULL MP 1000
India NULL 1800
NULL NULL 1800

ala vasthayi results...
Top of pagePrevious messageNext messageBottom of page Link to this message

2007
Kurra Bewarse
Username: 2007

Post Number: 676
Registered: 05-2006
Posted From: 129.188.33.222
Posted on Monday, July 17, 2006 - 5:22 pm:   Edit PostDelete PostView Post/Check IP

suppoer table data ila vundi

col1 col2 amt
India AP 100
India AP 200
India UP 200
India UP 300
India MP 300
India MP 600
India MP 100

select col1, col2, sum(amt)
group by rollup(col1, col2) ante

results ila vundiddi
India AP 300
India UP 500
India MP 1000
India NULL 1800
NULL NULL 1800

ade cube aithey all possible combinations tho aggregates vasthayi...
Top of pagePrevious messageNext messageBottom of page Link to this message

Bob
Vooriki Bewarse
Username: Bob

Post Number: 4068
Registered: 03-2005
Posted From: 65.64.34.45
Posted on Monday, July 17, 2006 - 5:20 pm:   Edit PostDelete PostView Post/Check IP


VEERABHADRA
Top of pagePrevious messageNext messageBottom of page Link to this message

2007
Kurra Bewarse
Username: 2007

Post Number: 675
Registered: 05-2006
Posted From: 129.188.33.222
Posted on Monday, July 17, 2006 - 5:19 pm:   Edit PostDelete PostView Post/Check IP

gochi mama CUBE, ROLLUP operators vunnayi rendu.. DWH lo data aggregates create cheyyataniki use chestharu... oracle 81 nunchi vunnayi..
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18372
Registered: 03-2004
Posted From: 24.136.161.233
Posted on Monday, July 17, 2006 - 5:06 pm:   Edit PostDelete PostView Post/Check IP

Thanks tmbuff mama, idi pani sesela undi sothunte.

PT mama, cube enti mama.
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24636
Registered: 07-2004
Posted From: 71.234.232.47
Posted on Monday, July 17, 2006 - 4:58 pm:   Edit PostDelete PostView Post/Check IP

CUBE enti PT maama...
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Tmbuff
Pilla Bewarse
Username: Tmbuff

Post Number: 150
Registered: 04-2004
Posted From: 159.153.4.51
Posted on Monday, July 17, 2006 - 4:29 pm:   Edit PostDelete PostView Post/Check IP

Hemanth mama --
You can use this query..
SELECT * FROM fa_locations WHERE COST_CENTER IN (SELECT COST_CENTER FROM fa_locations
HAVING COUNT(*) =1 GROUP BY COST_CENTER)
AND STATE IS NULL
Top of pagePrevious messageNext messageBottom of page Link to this message

Penkonda_tiger
Bewarse
Username: Penkonda_tiger

Post Number: 1637
Registered: 06-2005
Posted From: 62.234.167.180
Posted on Monday, July 17, 2006 - 4:25 pm:   Edit PostDelete PostView Post/Check IP

select Count(*) ,COST_CENTRE from (
select DISTINCT COST_CENTRE,STATE, Count(*) from fa_locations group by CUBE(STATE), COST_CENTRE)
where STATE is null group by COST_CENTRE having Count(*) = 1 ;

KIKIKI testing seskoondeeee
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18371
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 3:53 pm:   Edit PostDelete PostView Post/Check IP

perfect gochi mama. :-) Thanks mama srama anukokunda antha type chesinanduku, kani PT mama english lo adigadu ga, kani data ichav ga ardamavuthundi le. Thanks mama. :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24630
Registered: 07-2004
Posted From: 162.136.192.1
Posted on Monday, July 17, 2006 - 3:50 pm:   Edit PostDelete PostView Post/Check IP

Cost_centre, State

Chicago, IL
Dallas, TX
Hartford , CT
Hartford , --
NYC , --
Edison, NJ
Austin, TX
Austin , --
San Jose, --
LA , --
LA , --

oka vela paidhi oka sample table aithe manodiki state null ayivundi,repeat kaani cost centres kaavali

so output should be NYC and Sanhose...

kaani mana timbuff maama raasina daani prakaaram mundu state nulls ni filter tharavatha count(*) = 1 ante outputlo NYC,Sanhose tho paatu Hartford,Austin kooda vachesthaayi..

so mundu repeated vi theesesi tharavatha vaatilo state null pull seyyamani septhunnaa...

hemugaa asalu idenaa neeku kaavalsindhi...
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18368
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 3:44 pm:   Edit PostDelete PostView Post/Check IP

PT mama, Thanks mama, ippudu busy ga unna, okesari anni meda paddayi, mind block ayyindi. emanukokunda malla discudam mama. :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Penkonda_tiger
Bewarse
Username: Penkonda_tiger

Post Number: 1636
Registered: 06-2005
Posted From: 62.234.167.180
Posted on Monday, July 17, 2006 - 3:39 pm:   Edit PostDelete PostView Post/Check IP

GOCHI .. swaari , i dont think i understood the problem well .. dump a pseudoo table here ,and tell me the result set u need ..
Top of pagePrevious messageNext messageBottom of page Link to this message

Proofdadaa
Pilla Bewarse
Username: Proofdadaa

Post Number: 251
Registered: 06-2006
Posted From: 129.138.18.85
Posted on Monday, July 17, 2006 - 3:38 pm:   Edit PostDelete PostView Post/Check IP

mattadithe maasu porilu makku porilu antavv entehess

naathu anu ne tavaali
mana APA ki pesidentu vi ayyi vundi dicourage settavaakoosantha swet sesi pettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24626
Registered: 07-2004
Posted From: 162.136.192.1
Posted on Monday, July 17, 2006 - 3:35 pm:   Edit PostDelete PostView Post/Check IP

swaary...kaavalante old citykelli evathanna mass pigureni swaari sesuko..
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Proofdadaa
Pilla Bewarse
Username: Proofdadaa

Post Number: 249
Registered: 06-2006
Posted From: 129.138.18.85
Posted on Monday, July 17, 2006 - 3:33 pm:   Edit PostDelete PostView Post/Check IP

edi emaina ee swaari hyd ellinappudu ee pilla ni swaari seyyali
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24624
Registered: 07-2004
Posted From: 162.136.192.1
Posted on Monday, July 17, 2006 - 3:32 pm:   Edit PostDelete PostView Post/Check IP

poo ante nijam poo soopisthaaranukunnaava...oka usiri kaayani sagam koriki long shotlo zoom sesi soopittaaru..daanney nuvvu veredhi anukoni thrupthi padaali
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Proofdadaa
Pilla Bewarse
Username: Proofdadaa

Post Number: 247
Registered: 06-2006
Posted From: 129.138.18.85
Posted on Monday, July 17, 2006 - 3:30 pm:   Edit PostDelete PostView Post/Check IP

seppa kadaa..poo soopithe saalu carpet cleaning di emundi seppu
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24621
Registered: 07-2004
Posted From: 162.136.192.1
Posted on Monday, July 17, 2006 - 3:28 pm:   Edit PostDelete PostView Post/Check IP

kottanle..porapaatuna kottinanduku neeku oka saari anu carpet cleaning chance bonusgaa isthunnaam...
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Proofdadaa
Pilla Bewarse
Username: Proofdadaa

Post Number: 244
Registered: 06-2006
Posted From: 129.138.18.85
Posted on Monday, July 17, 2006 - 3:27 pm:   Edit PostDelete PostView Post/Check IP

tappu septhee kottettavaa
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24619
Registered: 07-2004
Posted From: 162.136.192.1
Posted on Monday, July 17, 2006 - 3:26 pm:   Edit PostDelete PostView Post/Check IP

PT maama...alaa union sesthey state null unna records + state null leni repeat ayina records anni vasthaayigaa

kaani manodiki state null ayyundi,cost centre repeat kaani records anni kaavali..ejjact opposite
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Penkonda_tiger
Bewarse
Username: Penkonda_tiger

Post Number: 1634
Registered: 06-2005
Posted From: 62.234.167.180
Posted on Monday, July 17, 2006 - 3:21 pm:   Edit PostDelete PostView Post/Check IP

Hemmu mammaa .. pardon my Telugu , i dont know if I understood ur problem properly ..

how ever check this out ...

select COST_CENTRE from fa_locations where STATE is NULL
Union
select COST_CENTRE from fa_locations where STATE is not null group by COST_CENTRE,STATE having count (*) = 1
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18361
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 2:59 pm:   Edit PostDelete PostView Post/Check IP

sare sotha aagu. vere pani vachindi. :-(
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18360
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 2:58 pm:   Edit PostDelete PostView Post/Check IP

oh reverse seppava. kiki.
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24616
Registered: 07-2004
Posted From: 162.136.192.1
Posted on Monday, July 17, 2006 - 2:56 pm:   Edit PostDelete PostView Post/Check IP

group by lo ante group by mundala ekkadanna ettacchu..
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18359
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 2:55 pm:   Edit PostDelete PostView Post/Check IP

group by lo where clause pettocha??
Top of pagePrevious messageNext messageBottom of page Link to this message

Gochi
Bewarse ke Bewarse!
Username: Gochi

Post Number: 24614
Registered: 07-2004
Posted From: 162.136.192.1
Posted on Monday, July 17, 2006 - 2:54 pm:   Edit PostDelete PostView Post/Check IP

select cost_center from (select * from fa_locations
having count(*) =1 ) where state is null
group by cost_center

idhi try seyyu...
yekku toli mettu kondanu kottu deekottu gattiga patte nuvv pattu gamyam cherettu
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18358
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 2:43 pm:   Edit PostDelete PostView Post/Check IP

tmbuff mama, problem vasthundi. inkokati cheppali ikkada.

aa table lo oka cost center repeat avvochu and oka daniki state undi inkoka daniki state undakapovachu.

appudu manam initial select * from ..where state is null annappudu aa repeated dantlo oka row state null di unte adi vachesthundi, kani count(*) dantlo filter avvadu.

so cost center repeat ayi, state null ayina oka row vachesthundi.

manaki kavalsindi cost center repeat avvakunda, state null unnadi kavali.

eg:cost center 123, 2 rows unnayi, oka daniki state null, inkokadaniki CA undi, indulo ee row rakodadu manaki. kani mana query aa null unna cost center row isthundi.

emi cheyyali ippudu.
Top of pagePrevious messageNext messageBottom of page Link to this message

Tyrael
Bewarse
Username: Tyrael

Post Number: 1252
Registered: 05-2006
Posted From: 65.174.40.114
Posted on Monday, July 17, 2006 - 1:51 pm:   Edit PostDelete PostView Post/Check IP

yenna cheta bingole mams
Top of pagePrevious messageNext messageBottom of page Link to this message

Bignole
Vooriki Bewarse
Username: Bignole

Post Number: 3955
Registered: 03-2004
Posted From: 161.225.1.12
Posted on Monday, July 17, 2006 - 1:46 pm:   Edit PostDelete PostView Post/Check IP

Top of pagePrevious messageNext messageBottom of page Link to this message

Penkonda_tiger
Bewarse
Username: Penkonda_tiger

Post Number: 1633
Registered: 06-2005
Posted From: 62.234.167.180
Posted on Monday, July 17, 2006 - 1:23 pm:   Edit PostDelete PostView Post/Check IP

KIKI Where clause looo STATE IS NULL anee endukuu adding syeaa kudaadu .. instead of using a inline view .. KIKIKI

ROLLUP luuu CUBE vadee savandee ..
Top of pagePrevious messageNext messageBottom of page Link to this message

Moviemaker
Bewarse
Username: Moviemaker

Post Number: 1835
Registered: 05-2004
Posted From: 65.82.104.120
Posted on Monday, July 17, 2006 - 1:22 pm:   Edit PostDelete PostView Post/Check IP

emugaa itanti taadulu rojuki 10 estey DB members anta oppice lo enta baga pani sestaro
Top of pagePrevious messageNext messageBottom of page Link to this message

Tmbuff
Pilla Bewarse
Username: Tmbuff

Post Number: 149
Registered: 04-2004
Posted From: 159.153.4.51
Posted on Monday, July 17, 2006 - 1:00 pm:   Edit PostDelete PostView Post/Check IP

Tyreal --

Nested selects inside a from shouldn't be a too much of performance issue. But peformance depends on too many variables and just can't be blamed on nested selects :-)

If the column is numeric and has less diversity, i will go with row_number function. We can also use CASE statement to see if that gives better performance.
Top of pagePrevious messageNext messageBottom of page Link to this message

Tyrael
Bewarse
Username: Tyrael

Post Number: 1240
Registered: 05-2006
Posted From: 65.174.40.114
Posted on Monday, July 17, 2006 - 12:25 pm:   Edit PostDelete PostView Post/Check IP

Tmbuff ,

performance wise ila nested select undakoodadu kada??
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18354
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 12:25 pm:   Edit PostDelete PostView Post/Check IP

mee andariki kullu.
Top of pagePrevious messageNext messageBottom of page Link to this message

Cricfan
Bewarse
Username: Cricfan

Post Number: 2434
Registered: 03-2005
Posted From: 24.162.127.185
Posted on Monday, July 17, 2006 - 12:23 pm:   Edit PostDelete PostView Post/Check IP

nee jeetham sagham DB members ivvu lekapothe mee manager ki septha
Nuvvu Man va Manchu Vamsam Pan va
Top of pagePrevious messageNext messageBottom of page Link to this message

Sgparri
Pilla Bewarse
Username: Sgparri

Post Number: 23
Registered: 07-2006
Posted From: 192.44.136.103
Posted on Monday, July 17, 2006 - 12:22 pm:   Edit PostDelete PostView Post/Check IP

hemanthaa nee pani baagundi gaa..
Last Man Standing...
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18353
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 12:21 pm:   Edit PostDelete PostView Post/Check IP

Thanks mama. work ayyindi.
Top of pagePrevious messageNext messageBottom of page Link to this message

Tmbuff
Pilla Bewarse
Username: Tmbuff

Post Number: 148
Registered: 04-2004
Posted From: 159.153.4.51
Posted on Monday, July 17, 2006 - 12:13 pm:   Edit PostDelete PostView Post/Check IP

select cost_center from (select * from fa_locations where state is null)
having count(*) =1
group by cost_center

this may help...
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18352
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 12:01 pm:   Edit PostDelete PostView Post/Check IP

>>ippudu naku only rows null value unnavi,

means state null value unnavi ani.
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18351
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Monday, July 17, 2006 - 11:59 am:   Edit PostDelete PostView Post/Check IP

mamalu, oka table lo oka column(state) values konni null undochu vatiki konni cost centers assign ayi undochu. adi inkoka column.

cost centers repititive undochu, ippudu naku only rows null value unnavi, cost centers repeat avvani list kavali. ela rayali quer??

select cost_center from fa_locations
having count(*) = 1
group by cost_center

ikkada state = null anedi ela add cheyyali??