Jump to content

Sql........


ilovekajal

Recommended Posts

[quote name='Vivian_afdb' timestamp='1341412071' post='1302078493']
:)
[/quote]
aaa pic entayya... fafa bagundi masaala fost veyyi poddunnee [img]http://25.media.tumblr.com/avatar_6feb8634e3d0_128.png[/img]

Link to comment
Share on other sites

What is the type of the column in the table? If it is not integer, Try to create a temporary table with only one integer column and copy the column values to the new temp table.

Link to comment
Share on other sites

describe dw_stg_imrt.dlz_wksp_bph_d
Name Null Type
----------------- ---- -------------
CURRENT_MONTH VARCHAR2(200)
DATA_TYPE VARCHAR2(200)
PAYMENT_TYPE VARCHAR2(200)
SPECIALTY VARCHAR2(200)
SPECIALTY_DESCR VARCHAR2(200)
PRODUCT VARCHAR2(200)
FORM VARCHAR2(200)
STRENGTH VARCHAR2(200)
METRICS VARCHAR2(200)
TRX_QTY VARCHAR2(200)
TRX_COUNT VARCHAR2(200)
NRX_QTY VARCHAR2(200)
NRX_COUNT VARCHAR2(200)
RRX_QTY VARCHAR2(200)
RRX_COUNT VARCHAR2(200)
PROCESSED_FLG CHAR(1)
LOAD_CONTROL_SKEY NUMBER

Link to comment
Share on other sites

[quote name='ilovekajal' timestamp='1341412615' post='1302078518']
describe dw_stg_imrt.dlz_wksp_bph_d
Name Null Type
----------------- ---- -------------
CURRENT_MONTH VARCHAR2(200)
DATA_TYPE VARCHAR2(200)
PAYMENT_TYPE VARCHAR2(200)
SPECIALTY VARCHAR2(200)
SPECIALTY_DESCR VARCHAR2(200)
PRODUCT VARCHAR2(200)
FORM VARCHAR2(200)
STRENGTH VARCHAR2(200)
METRICS VARCHAR2(200)
TRX_QTY VARCHAR2(200)
TRX_COUNT VARCHAR2(200)
NRX_QTY VARCHAR2(200)
NRX_COUNT VARCHAR2(200)
RRX_QTY VARCHAR2(200)
RRX_COUNT VARCHAR2(200)
PROCESSED_FLG CHAR(1)
LOAD_CONTROL_SKEY NUMBER
[/quote]

nuvvu sum chestunna field edi mama..?

Link to comment
Share on other sites

[quote name='ilovekajal' timestamp='1341412615' post='1302078518']
describe dw_stg_imrt.dlz_wksp_bph_d
Name Null Type
----------------- ---- -------------
CURRENT_MONTH VARCHAR2(200)
DATA_TYPE VARCHAR2(200)
PAYMENT_TYPE VARCHAR2(200)
SPECIALTY VARCHAR2(200)
SPECIALTY_DESCR VARCHAR2(200)
PRODUCT VARCHAR2(200)
FORM VARCHAR2(200)
STRENGTH VARCHAR2(200)
METRICS VARCHAR2(200)
TRX_QTY VARCHAR2(200)
TRX_COUNT VARCHAR2(200)
NRX_QTY VARCHAR2(200)
NRX_COUNT VARCHAR2(200)
RRX_QTY VARCHAR2(200)
RRX_COUNT VARCHAR2(200)
PROCESSED_FLG CHAR(1)
LOAD_CONTROL_SKEY NUMBER
[/quote]
2 diff columns sum chestunnava>? leka all rows in a column aa?

Link to comment
Share on other sites

trx_qty or trx_count.........any of thjeese two field would be ok..................i even tried [color=#282828][font=helvetica, arial, sans-serif]select sum(to_number(trx_qty)) from [/font][/color][color=#282828][font=helvetica, arial, sans-serif]dw_stg_imrt.dlz_wksp_bph_d this way but same eror[/font][/color]

Link to comment
Share on other sites

[quote name='HAPPYNESS' timestamp='1341412945' post='1302078533']
2 diff columns sum chestunnava>? leka all rows in a column aa?
[/quote]

all rows in a column

Link to comment
Share on other sites

[quote name='ilovekajal' timestamp='1341413137' post='1302078540']
trx_qty or trx_count.........any of thjeese two field would be ok..................i even tried [color=#282828][font=helvetica, arial, sans-serif]select sum(to_number(trx_qty)) from [/font][/color][color=#282828][font=helvetica, arial, sans-serif]dw_stg_imrt.dlz_wksp_bph_d this way but same eror[/font][/color]
[/quote]

so nuvvu.. varchar2 ni sum chestunnav kabatti.. adi int ga kudaradu anduke ee error vastundi anukunta[img]http://www.bewarsetalk.net/discus/movieanimated9/bemmi.thinking.gif[/img]

Link to comment
Share on other sites

Can you post sample records from those two columns? Even after you convert them to number, you might not be able to sum it up because of various reasons. Post 10 records from both the columns, so we know what kind of data is there.

Link to comment
Share on other sites

[color=#333333]SELECT SUM(CONVERT (int,ColumnName)) [/color][color=#333333] from TableName[/color]

[color=#333333]SELECT SUM(CONVERT (Bigint,ColumnName)) [/color][color=#333333] from TableName[/color]

[color=#333333]SELECT SUM(CONVERT (Float,ColumnName)) [/color][color=#333333] from TableName[/color]

[color=#333333]select sum(cast(columnname as int)) from TableName[/color]

Link to comment
Share on other sites

[quote name='kiraaaak' timestamp='1341413871' post='1302078584']
nee query copy seyy ba oka sari
[/quote]

[color=#282828][font=helvetica, arial, sans-serif]select sum(to_number(trx_qty)) from [/font][/color][color=#282828][font=helvetica, arial, sans-serif]dw_stg_imrt.dlz_wksp_bph_d ila try chesa bhayya kani same eror showing up again[/font][/color]

Link to comment
Share on other sites

data type varchar lo undhii so anni rec numbers e undakapovochuu...
strings aina undi unatiiii!!!!

chesedhi pl-sql aaa t-sql aaa???

select [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]TRX_QTY[/background][/size][/font][/color]
from [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]dw_stg_imrt.dlz_wksp_bph_d[/background][/size][/font][/color]
where like %a%


strings em aina unte telustahi kadaa!!

Link to comment
Share on other sites

Kachitanga edho oka row lo numbers kaakunda vere characters undi untayi. Andhuke error.

Aa column motham lo edaina non numeric characters unnayemo test cheyyataniki run this...


SELECT * FROM dw_stg_imrt.dlz_wksp_bph_d
WHERE LENGTH(TRIM(TRANSLATE(trx_qty, ' +.0123456789-', ' '))) > 0

If this query returns any rows, nee data lo non numeric fields unnattu... run chesi cheppu em vasthundo...

Link to comment
Share on other sites

[quote name='Sir' timestamp='1341414529' post='1302078633']
Kachitanga edho oka row lo numbers kaakunda vere characters undi untayi. Andhuke error.

Aa column motham lo edaina non numeric characters unnayemo test cheyyataniki run this...


SELECT * FROM dw_stg_imrt.dlz_wksp_bph_d
WHERE LENGTH(TRIM(TRANSLATE(trx_qty, ' +.0123456789-', ' '))) > 0

If this query returns any rows, nee data lo non numeric fields unnattu... run chesi cheppu em vasthundo...
[/quote]


yes bhayya konni roes return chesindhi.......6031 rows return chesindhi bhayya........so wat to do next?

Link to comment
Share on other sites

×
×
  • Create New...