asp.net - kindly guide me where i am wrong? -


i have database daily sale recorded. want client outstanding between 2 dates. date_ column in varchar. m not getting required result.through query , when used between query showing wrong data.so solution? kindly

select clientid [id],sum(convert(float, total)) [sum]         buffalo_milk_sale         clientid between 'hd001' , 'hd099'         , convert(datetime, date_, 103) >= convert(datetime, '01/09/2014', 103)         , convert(datetime, date_, 103) <= convert(datetime, '09/09/2014', 103) group clientid 

error

the conversion of varchar data type datetime data type resulted in out-of-range value.

try this

select clientid [id],sum(convert(float, total)) [sum]  buffalo_milk_sale  clientid between 'hd001' , 'hd099'  , convert(varchar(10), date_, 111) >= convert(datetime, '01/09/2014', 103)  , convert(varchar(10), date_, 111) <= convert(datetime, '09/09/2014', 103) group clientid 

Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -