0
I need to update an existing table by adding a new column. Below is the sample data for the first table which needs to be updated with the new column(Ticket_No_Calc).

And here is the sample data of the second table.
In Excel, I use this formula in order to get the output for the new column (Ticket_No_Calc).
Text
=IFERROR(IF(D2="MKT",INDEX(Second!A:A,MATCH(First!B2,Second!B:B,0),0),INDEX(Second!A:A,MATCH(First!C2,Second!B:B,0),0)),INDEX(Second!A:A,MATCH(First!A2,Second!B:B,0),0))
I am not sure on how to translate this formula into SQL command. Could someone please help me with this please
Thank you.