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 are junk dimensions?

634


What is data caches/ index caches?

615


What are active and passive transformations?

652


What are the new features of informatica 9.x developer?

533


What is the different lookup cache(s)?

614






-Which expression we can not use in Maplets?, -Can we join(relate) two dimensions in a schema? -Why and where we use 'sorted input' option?

4985


What is data movement mode in Informatica and difference between them?

622


what is unit testing?tell me proceedure

1782


How do we call shell scripts from informatica?

599


What is a mapplet/worklet in informatica?

692


Define joiner transformation?

596


Enlist the differences between database and data warehouse.

550


Explain the use of aggregator cache file?

678


How you know when to use a static cache and dynamic cache in lookup transformation?

1341


What are the types of lookup transformation?

631