asp.net - View all data from a GROUP BY statement -


i demonstrate simple example of issue instead of viewing long sql query project.

my example like:

select deliveryaddressid, pickupdate, totalweight, count(deliveryaddressid) packages deliverydb date1 >= '10-12-2013' , date2 <= '15-12-2013' group  pickupdate, deliveryaddressid 

my result like:

http://prntscr.com/1iksoe

what want achieve deliveryaddressid 4 packages still keep total numbers. this.

what want expected result:

http://prntscr.com/1iksr7

the reason want because in way able track barcode each package , able track more details.

cheers :-)

in databases, can using window functions:

select deliveryaddressid, pickupdate, totalweight,        count(deliveryaddressid) on (partition pickupdate, deliveryaddressid) packages deliverydb date1 >= '10-12-2013' , date2 <= '15-12-2013'; 

this return total on 4 lines.

edit:

you can handle totalweight (which not part of original question) same way:

select deliveryaddressid, pickupdate,        count(deliveryaddressid) on (partition pickupdate, deliveryaddressid) packages,        ceiling(sum(case when (weight <> 0 , volumen <> 0) , weight >= (volumen * @zerovolufac)                         weight                    end) on (partition pickupdate, deliveryaddressid)               ) totalweight deliverydb date1 >= '10-12-2013' , date2 <= '15-12-2013'; 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -