| 
                
Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with. 
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | asifbhuraPosting Yak  Master
 
 
                                        165 Posts | 
                                            
                                            |  Posted - 2013-09-06 : 08:11:11 
 |  
                                            | Hellomy query isSELECT     TOP 100 PERCENT 0 AS FeeCollectionDetail_Id, 0 AS FeeCollection_Id,mst.Admission_Id AS Student_Id, mst.Student_RegNo, mst.Student_Name,                       '' AS FromMonth_Date, '' AS ToMonth_Date, 0 AS Fee_Amount, 0 AS Fee_Library, 0 AS Fee_Computer, 0 AS Fee_Transportation, 0 AS Fee_Sports,                       0 AS Fee_Art, 0 AS Fee_Admission, 0 AS Fee_Insurance, 0 AS Fee_Discount, 0 AS Fee_Other, mst.Family_Id, ISNULL(dbo.vw_Section.Grade_Section,                       N'') AS Grade_SectionFROM         dbo.tbl_Admission mst INNER JOIN                      dbo.tbl_Family dtl ON mst.Family_Id = dtl.Family_Id INNER JOIN                      dbo.tbl_Enrollment ON mst.Admission_Id = dbo.tbl_Enrollment.Student_Id INNER JOIN                      dbo.vw_Section ON dbo.tbl_Enrollment.Section_Id = dbo.vw_Section.Section_IdWHERE     (mst.Is_Active = 1) AND (dbo.tbl_Enrollment.Year_Id >= '8')                           ORDER BY mst.Family_Idnormally it works finebut when we promote student to next class it shows bothe records,with current grade and the new grade which we promote student to next grade..I want to display with the latest grade which means where we promoted him, please help me out |  |  
                                    | bandiMaster Smack Fu Yak Hacker
 
 
                                    2242 Posts | 
                                        
                                          |  Posted - 2013-09-06 : 08:21:45 
 |  
                                          | While joining dbo.vw_Section view in the JOIN take only Latest Sections of each student and then join...If you doesn't get my point post us back with dbo.vw_Section column names...--Chandu |  
                                          |  |  |  
                                    | asifbhuraPosting Yak  Master
 
 
                                    165 Posts | 
                                        
                                          |  Posted - 2013-09-06 : 08:32:45 
 |  
                                          | SELECT     dbo.tbl_Grade.Grade_Id, dbo.tbl_Grade.Grade_Name, dbo.tbl_Section.Section_Id, dbo.tbl_Section.Section_Name,                       dbo.tbl_Grade.Grade_Name + ' - ' + dbo.tbl_Section.Section_Name AS Grade_Section, dbo.tbl_Section.Employee_IdFROM         dbo.tbl_Section INNER JOIN                      dbo.tbl_Grade ON dbo.tbl_Section.Grade_Id = dbo.tbl_Grade.Grade_Idhere is the code for vw.section |  
                                          |  |  |  
                                    | bandiMaster Smack Fu Yak Hacker
 
 
                                    2242 Posts | 
                                        
                                          |  Posted - 2013-09-06 : 09:18:57 
 |  
                                          | which table gets data if student get promoted to next grade ?--Chandu |  
                                          |  |  |  
                                    | asifbhuraPosting Yak  Master
 
 
                                    165 Posts | 
                                        
                                          |  Posted - 2013-09-06 : 17:27:25 
 |  
                                          | the table is tbl_Enrolment where students get promoted  and structure isenrolment_id, year_id,student_id, section_idand tbl_grade structure is grade_id, grade_nameand tbl_Section structure is section_id, grade_id, section_name |  
                                          |  |  |  
                                |  |  |  |  |  |