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 / jd

this can be done using FIRST_VALUE() AND LAST_VALUE()

check the below link for more information

http://netezzamigration.blogspot.com/2014/10/lastvalue-and-firstvalue-best-example.html

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an Integration service in Informatica?

699


While migrating the data from one environment to another environment how would you manage the connections?

623


What is the status code in stored procedure transformation?

683


What are the advantages of informatica?

571


What is informatica etl tool?

548






What is the commit type if you have a transaction control transformation in the mapping?

650


How do you load more than 1 max sal in each department through informatica or write sql query in oracle?

1004


What is transformation?

656


Why sorter is an active transformation?

746


I need the output file in the below format using Informatica. __0946684800__ 6 1 3 1 5 1 6 1 10 1 6 10 Pos State Time Split AgentID Reason Spaces Code in Code Spare state ______ ___ _____ ______ __________ ______ 1234 14 0 4321 3103 abcd 4321 15 5 123452 3150 Can someone help please?? We need the data in space-delimited, fixed ASCII format .

1469


HOW TO PROCESS THE ROWS FROM JOINER AND EXPRESSION TRANSFORAMTION TO SORTER TRANSFORMATION

1471


Define pmcmd command?

618


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

614


What are the popular informatica products?

648


What are the restrictions of union transformation?

576