hello
Let me explain first the table structure.
t
here i want the Closing_Stock value of particular District_ID and Commodity_ID and Distribution_Ca t_ID and for particular month where Date=MAX(date)
If i gave query like this
From the above result i need like this
anybody knows solution for the above issue please let me know.
thanks
Let me explain first the table structure.
t
Code:
able - > pds fields - >District_ID, W_ID, Commodity_ID, Distribution_Cat_ID, Date, OB, Closing_Stock
If i gave query like this
Code:
SELECT W_ID, date, Closing_Stock FROM `pds` WHERE District_ID = '3' AND Commodity_ID = '1' AND Distribution_Cat_ID = '1' AND Month( date ) = '12'
Code:
W_ID date Closing_Stock
176 2008-12-01 0.00
176 2008-12-10 337.36
176 2008-12-11 26.84
177 2008-12-02 0.00
177 2008-12-10 468.84
177 2008-12-11 446.52
180 2008-12-01 0.00
181 2008-12-02 0.00
181 2008-12-06 0.00
353 2008-12-02 900.00
353 2008-12-11 232.72
354 2008-12-01 5.33
354 2008-12-04 589.30
354 2008-12-10 722.45
354 2008-12-11 117.69
355 2008-12-01 1000.00
355 2008-12-06 1547.32
356 2008-12-01 1400.00
357 2008-12-02 0.00
357 2008-12-06 800.00
358 2008-12-01 600.00
358 2008-12-10 222.37
358 2008-12-11 118.20
Code:
W_ID MAX(date) Closing_Stock 176 2008-12-11 26.84 177 2008-12-11 446.52 180 2008-12-01 0.00 181 2008-12-02 0.00 353 2008-12-11 232.72 354 2008-12-11 117.69 355 2008-12-06 1547.32 356 2008-12-01 1400 357 2008-12-06 800 358 2008-12-11 118.20
thanks
Comment