Hi all,
I have a question regarding the selection of arrival and departure city.
There are One way, Round trips and journey with connecting flights in the above data, what I am looking for a report is tktamt, deprt city, arrival city and tktnum in a single line for each trip.
SO if it is one way trip or round trip there is no issue, if it is a trip with connecting flights tktnum has more than four records. In the above case for tktnum 34567 there are four records, for which I have to display only one record, where the depart city is 'JFK and Arrival city is 'SFO' as well as amount and tktnum.
Please suggest any solutions.
Thanks in advance!
I have a question regarding the selection of arrival and departure city.
SQL:
CREATE TABLE #XY123
(
tktamt MONEY,
departcty VARCHAR(5),
arrivalcty VARCHAR(5),
tktnum INT
)
INSERT INTO #XY123
SELECT '100.00',
'DFW',
'LGA',
12345
UNION ALL
SELECT '120.00',
'MIA',
'ATL',
23456
UNION ALL
SELECT '120.00',
'ATL',
'MIA',
23456
UNION ALL
SELECT '250.00',
'JFK',
'PHX',
34567
UNION ALL
SELECT '250.00',
'PHX',
'SFO',
34567
UNION ALL
SELECT '250.00',
'SFO',
'PHX',
34567
UNION ALL
SELECT '250.00',
'PHX',
'JFK',
34567
--DROP TABLE #test1
SELECT *
FROM #test1
There are One way, Round trips and journey with connecting flights in the above data, what I am looking for a report is tktamt, deprt city, arrival city and tktnum in a single line for each trip.
SO if it is one way trip or round trip there is no issue, if it is a trip with connecting flights tktnum has more than four records. In the above case for tktnum 34567 there are four records, for which I have to display only one record, where the depart city is 'JFK and Arrival city is 'SFO' as well as amount and tktnum.
Please suggest any solutions.
Thanks in advance!