Consider a Phone Log table as below. It records all phone numbers that we dial in a given day.




SOURCE_PHONE_NUMBER
DESTINATION_PHONE_NUMBER
CALL_START_DATETIME
1234
4567
01/07/2011 10:00
1234
2345
01/07/2011 11:00
1234
3456
01/07/2011 12:00
1234
3456
01/07/2011 13:00
1234
4567
01/07/2011 15:00
1222
7890
01/07/2011 10:00
1222
7680
01/07/2011 12:00
1222
2345
01/07/2011 13:00




Please provide an SQL query to display the source_phone_number and a flag where the flag needs to be set to Y if first called number and last called number are the same and N if the first called number and last called number are different.




Desired Output:




Source Number
Is_Match
1222
N
1234
Y

Answer Posted / kivi

first value and last value...

for more info ref 

http://etltechsolutions.wordpress.com/2014/10/12/last_value-and-first_value-best-example/

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are the different versions of informatica?

653


in u flatfile some of fact records are missed then u load the diminision records are not if u load diminsion records what about fact table records

1729


What are the components of workflow manager?

584


How to generate sequence numbers?

616


What is workflow monitor?

593






i had a source containing business,sales,details column and i have to load it to a target but i have some bad records in it , but i have to load 70% of business records and 50% of sales and 95% of details records excluding bad records to achieve this what should be done and what all logic and tx should be used can anyone help? thanks in advance

1667


Explain the types of lookup transformation?

565


Different sorts of metadata that stores in the storage facility?

554


What is enterprise data warehousing?

611


How to differentiate between the active and passive transformations?

621


What are the various types of transformation?

640


What are active and passive transformations?

647


How to open an older version of an object in the workspace?

614


Can I use same Persistent cache(X.Dat) for 2 sessions running parallely? If it is not possible why?If yes How?

1616


What is aggregator transformation in informatica?

539