Honey Singh
Honey Singh

Reputation: 382

Combining multiple rows using SQL

Below table displays package transferred from origin to destination.

[![enter image description here][1]][1]

Explanation:

  1. Sent America 2022-11-23 18:30:00.000 Reached China 2022-11-24 05:00:00
  2. Sent China 2022-11-24 08:18:00.000 Reached Argentina 2022-11-24 18:18:00.000
  3. Sent Argentina 2022-11-25 18:30:00.000 and reached Saudi Arabia 2022-11-25 20:30:00.000

Upvotes: 1

Views: 59

Answers (1)

logesh sankar
logesh sankar

Reputation: 248

I hope the below answer is suitable for you.

less than <

select  f.id,f.Country CountryFrom, t.Country CountryTo
, convert(varchar(4),f.seqNo) + '-' + convert(varchar(4),t.seqNo) seqNo
, f.Send, t.Arrive,concat('Send ', f.Country ,' ', f.Send,' Reached ', t.Country,' ',t.Arrive) Remarks from IPhone f inner join IPhone t on f.seqNo < t.seqNo order by id;

Thanking you

Upvotes: 3

Related Questions