Ganapathi sundaram wrote:
Can we do multiple result row as a single row while selection ..?
Request you to provide the SQL if we can achieve this...
For Eg,
Table Name = Employee
id - EmployeeName - addresstype - address1 - address2 - City
1 - AAA - permanent - 231 - First Street - XYA
2 - AAA - Temporary - 343 - Second Street - XYA
Expecting Result as a Single row as below,
id - EmployeeName - Address1 - Address2
1 - AAA - 231/First Street/XYA - 343/Second Street/XYA
If each employee will have at most two addresses (permanent and
temporary), then this should work:
select
id,
max(EmployeeName) EmployeeName,
max(case addresstype
when 'permanent' then address1 + '/' + address2 + '/' + city
end) Address1,
max(case addresstype
when 'temporary' then address1 + '/' + address2 + '/' + city
end) Address2
from Employee
group by id