Click here to Skip to main content
15,891,409 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello friends i am preparing stock report in a project.

currently it is like this

[date] [opening stock] [sent qty] [ rec qty] [ closing stock]
1 april 2012 22 4 18
1 april 2012 18 10 28
2 april 2012 28 6 22
2 april 2012 22 100 122


but it should display like this
[date]           [opening stock]         [sent qty]    [ rec qty]          [ closing stock]

1 april 2012 22 4 --- --

------------ --- ---- 10 28
2 april 2012 28 6 ---- ----

------------- ---- ----- 100 122

(Here opening stock, closing stock should not repeat for a single date.)
friends can you please help me in showing data in correct format in gridview
thanks in advance friends
Posted
Updated 23-Aug-12 19:39pm
v7
Comments
veenusethi 24-Aug-12 1:30am    
please explain your question in detail

1 solution

try below query:-

SQL
select dt, opening_stock, sent_qty, rec_qty, closing_stock  from (
select dt, opening_stock, sent_qty, null rec_qty, null closing_stock ,dt as dt1 from users
union all
select null dt, null opening_stock, null sent_qty, rec_qty,  closing_stock , dt as dt1 from users
) a
order by dt1

*your [date] field is dt here

now you can bind it to gridview..
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900