Column concatenation in SQL Server

Hi friends ,

Last week , I was facing one problem regarding column summary report. For that purpose , we tried joins,unions etc .

But we tried one query , which seems to be subquery  but some professional defined as pointer in sql server.

Post description as follows,

We need report of Students which include ,

Studentid,StudentName,Studentaddree,UnitTest1marks ,Absent hrs

Query :

select studId,studName,Studaddre,Sum(TEstMarks) ,ab.absentHrs
-- SUM(convert(float,a.[absent])) as absentHrs
From  StudPerformance.dbo.Card_Data a
inner Join StudPerformance.dbo.Rate_mast b On a.stud_cd = b.stud_no Anda.mach_cd = b.machine_cd
and a.proc_cd = b.process_cd
Join (Select a.stud_no,
    Sum(Convert(float,a.[absent])) / 60 As absentHrs
  From StudPerformance.dbo.Job_Card_Data a
  Where a.entry_date Between @p_from_date And
  @p_to_date And
    a.entry_date = a.entry_date And
a.class_group = 'FirstStd'
And a.class_group = a.class_group
  Group By a.studId,a.studAddre


Here Result will be as


Studentid,StudentName,Studentaddree,UnitTest1marks ,Absent hrs

Ab.absenthrs join as new column after execution completed.

I will share you more on this , bcos its nt concept . It will useful as logic for implementation.
Gud day!!





 

Comments

Popular posts from this blog

Add Serial no in crystal report without coding

File operations in C# (.net)

SQL – Generate decimal numbers sequence for particular number range