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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
i have flat file it contains 'n' number of records, i need to send half of the records to one target table and Remaining half to another target table: pls full details
8 Answers L&T, TCS, UnitedHealth Group, Wipro,
star and snowflake schema?
1) Alternative to update strategy transformation 2) out of 1000 records after loading 200 records, the session got failed. how do u load the rest of records ?? 3) use of lookup override
Can you start a session inside a batch individually?
How do you implement scheduling in Informatica?
Do you have to change the reject file b4 using reject loader utility.
two tables from two different databases r there . both having same structure but different data . how to compare these two tables ?
Plz..let me know differences between Informatica 7.1 and 8.1?
How to start a workflow using pmcmd command?
How can yoU create or import flat file definition in to the warehouse designer?
I have source table 100 records after run session successfully but loads the target table 50 records only what happened that 50 records and how can i load remaining 50 records
How the facts will be loaded? explain