badboy7 Posted July 26, 2012 Report Posted July 26, 2012 [quote name='TITANIC' timestamp='1343333154' post='1302205704'] HELP PLS......... [/quote] orey ayya.....adi 1 and o antunav kada ....... asalu error emi vasthundo cheppu dani bati query rayachu... lekapote msdn forums ki poyi 2 min lo register avu..... adu help sestharu... thopu raja lu vuntar akada...
ChampakDas Posted July 26, 2012 Report Posted July 26, 2012 ohh dint see your query...@[url="http://www.andhrafriends.com/user/24005-ghazni/"]ghazni[/url] was right
ChampakDas Posted July 26, 2012 Report Posted July 26, 2012 Just by looking Query wrong ani ardam avutundhi. You are saying that when certain column value is NULL make it '0' else blah blah..so the inside statement returns just a single value unless you have something else in the query or in the group by. [quote name='TITANIC' timestamp='1343330623' post='1302205511'] COUNT( case when DETAIL_POSITION IS NULL then 1 else 0 END when NVL(A.sample_drop_qty,0) <> 0 then 1 else 0 END when (PROMO_DROP_QTY IS NULL OR PROMO_DROP_QTY = 0 ) then 1 else 0 END A.CALL_HEADER_ID) AS CALL_CNT idhi bhayya asalu query........ [/quote]
ghazni Posted July 26, 2012 Report Posted July 26, 2012 asalu thread start chesi ekadiki poyav titanic......... kajal pilichinda......
ilovekajal Posted July 26, 2012 Author Report Posted July 26, 2012 COUNT( A.CALL_HEADER_ID) AS CALL_CNT paina unna count lo case statement use chesi kindha unnva vatini implement cheyyali DETAIL_POSITION IS NOT NULL and A.sample_drop_qty > 0 AND A.sample_drop_qty IS NOT NULL and (PROMO_DROP_QTY IS NULL OR PROMO_DROP_QTY = 0 )
ghazni Posted July 26, 2012 Report Posted July 26, 2012 [quote name='TITANIC' timestamp='1343335390' post='1302205955'] COUNT( A.CALL_HEADER_ID) AS CALL_CNT paina unna count lo case statement use chesi kindha unnva vatini implement cheyyali DETAIL_POSITION IS NOT NULL and A.sample_drop_qty > 0 AND A.sample_drop_qty IS NOT NULL and (PROMO_DROP_QTY IS NULL OR PROMO_DROP_QTY = 0 ) [/quote] try to use SUM and take of END in each case and put END only in the last.........
pandemkodi Posted July 26, 2012 Report Posted July 26, 2012 idi try pls COUNT( case when (DETAIL_POSITION IS NOT NULL) or (NVL(A.sample_drop_qty,0) <> 0) or (PROMO_DROP_QTY IS NULL OR PROMO_DROP_QTY = 0 )then 1 else 0 END ) AS CALL_CNT
Desamudhuru Posted July 26, 2012 Report Posted July 26, 2012 [img]http://lh3.ggpht.com/-CPEG0Ow-qrk/TeV3y39qNYI/AAAAAAAACqA/xZGGo2-N294/RT.gif[/img] epudu chepu ni doubt enti asalu
saritha24 Posted July 26, 2012 Report Posted July 26, 2012 [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]SELECT COUNT( A.CALL_HEADER_ID) AS CALL_CNT FROM XXXXXXXX[/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]WHERE [/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif]DETAIL_POSITION IS NOT NULL [/font][/color] [color=#282828][font=helvetica, arial, sans-serif]and A.sample_drop_qty > 0 AND A.sample_drop_qty IS NOT NULL[/font][/color] [color=#282828][font=helvetica, arial, sans-serif]and (PROMO_DROP_QTY IS NULL OR PROMO_DROP_QTY = 0 ) [/font][/color] [color=#282828][font=helvetica, arial, sans-serif]OR [/font][/color] [color=#282828][font=helvetica, arial, sans-serif]SELECT [/font][/color][color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]COUNT( [/background][/size][/font][/color] ( [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]DETAIL_POSITION IS NOT NULL[/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]and A.sample_drop_qty > 0 AND A.sample_drop_qty IS NOT NULL[/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]and (PROMO_DROP_QTY IS NULL OR PROMO_DROP_QTY = 0 ) [/background][/size][/font][/color][color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]THEN A.CALL_HEADER_ID ELSE NULL[/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]) AS CALL_CNT[/background][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=3][background=rgb(247, 247, 247)]FROM XXXXX[/background][/size][/font][/color]
Recommended Posts