12,953,937 members (42,878 online)
Rate this:
See more:
I have 3 Table View to DataGridView

This Table Data Want Display

```Table1 (StudentDetails)
Regno	Name	Class	Section
A100	Raja	I	A
A200	Ravi	I	A```

This Table Filed Want Display To DataGridView Column

Table2(Fees Structure)
```Class	FeeType	Total Amount
I	Jan	1500
I	Feb	2500
I	Mar	1500
I	Apr	3000
I	Other	500```

This Talbe Data Show to DGV
Table3 ( FeesTrans)
```Regno 	Sname	Class	FeeType	Amount
A100	Raja	I	Jan	1000
A100	Raja	I	Jan	500
A100	Raja	I	Feb	2500
A100	Raja	I	Other	500
A200	Ravi	I	Jan	1500
A200	Ravi	I	Other	500```

I want DataGridView Like This

```Regno	Sname	Class	Section	Jan	Feb	Mar	Apr	Other	Total
A100	Raja	I	A	1500	500	0	0	500	2500
A200	Ravi	I	A	1500	0	0	0	500	200```
Posted 17-Jan-13 7:17am
Updated 18-Jan-13 0:16am
v4
richcb 17-Jan-13 15:36pm

This is not a question. Use the "Improve Question" widget to elaborate on what you are tring to achieve and provide the code you have attempted in order to accomplish that goal.

Rate this:

## Solution 1

try this. just modify the query and join the needed tables.
```SELECT Regno, Sname, Class, Section,
SUM(CASE WHEN FeeType = 'Jan' THEN Amount ELSE 0 END) AS Jan,
SUM(CASE WHEN FeeType = 'Feb' THEN Amount ELSE 0 END) AS Feb,
SUM(CASE WHEN FeeType = 'Mar' THEN Amount ELSE 0 END) AS Mar,
SUM(CASE WHEN FeeType = 'Apr' THEN Amount ELSE 0 END) AS Apr,
SUM(CASE WHEN FeeType = 'Other' THEN Amount ELSE 0 END) AS Other,
SUM(FeeType) AS 'Total'
FROM <TableName>
GROUP BY Regno```
Navas Khanj 18-Jan-13 6:06am

Hi Tanks for Yor Replay.. But Wht i want.. Table 1 and Table 3 data Show to DataGirdView.. and Table 2 Data Show to DataGridView Column Header Text..

Top Experts
Last 24hrsThis month
 ppolymorphe 100 OriginalGriff 75 RickZeeland 60 Dave Kreskowiak 38 Member 13197019 35
 OriginalGriff 6,464 CHill60 3,490 Maciej Los 3,123 ppolymorphe 2,020 Jochen Arndt 1,975