422,904 Members | 1,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,904 IT Pros & Developers. It's quick & easy.

Help to develop Views from following tables

Gobindap
P: 24
Hi, am trying to develop a .Net program using MS Sql server
Using calculation in user-end made my application too slow.
So I am trying to make such calculation in server and just call dataTable in use-end
For this I need a sql query that is able to generate following desired View.
Primary information about basic Tables are as follows.
I tried to use different sql builder with no success.


Please help me

Thanking you in advance

I have 4 tables as

Table1 (students_Detail)
Expand|Select|Wrap|Line Numbers
  1. studID      studName    gradeID    address
  2. --------------------------------------
  3. 1    Name1        1    add
  4. 2    Name2        1    add
  5. 3    Name3         2    add
  6. 4    Name4         2    add
  7.  
Table2 (FeeList)
Expand|Select|Wrap|Line Numbers
  1. FeeID   FeeDetail
  2. -----------------
  3. 1    Admission 
  4. 2    Monthly Fee
  5. 3     Vehicle Fee 
  6. 4     Medical Fee
  7.  
Table3 (FeeRate)
Expand|Select|Wrap|Line Numbers
  1. sn    FeeID    gradeID    Rate
  2. 1    1    1    1000
  3. 2    1    2    1200
  4. 3    2    1    1500
  5. 4    2    2    1600
  6. 5    3    1    800
  7. 6    3    2    900
  8.  
  9.  
Table4 (Discount)
Expand|Select|Wrap|Line Numbers
  1. studID    FeeID    DiscPercent
  2. 1    1    100
  3. 1    2    50
  4. 1    3    10
  5. 1    4    50
  6. 2    1    50
  7. 2    2    10
  8.  

Now I need SQL to browse these data as follows
Desired View
Expand|Select|Wrap|Line Numbers
  1. studID    studName    FeeDetail     Total    Discount    NetAmount
  2. ---------------------------------------------------------------------------
  3. 1    Name1        Admission    1000    1000        0
  4. 1    Name1        Montly Fee    1200    600        600
  5. 1    Name1        Vehicle Fee    1500    150        1350
  6. 1    Name1        Medical Fee    1600    800        800
  7. 2    Name2        Admission    1000    500        500
  8. 2    name2        Montly Fee    1200    120        1150
  9. 2    Name2        Vehicle Fee    1500    0        1500
  10. 2    Name2        Medical Fee    1600    0        1600
Attached Files
File Type: txt SQL Question.txt (1,002 Bytes, 4 views)
File Type: xlsx SQL Question.xlsx (9.8 KB, 3 views)
3 Days Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.