I have two tables, Table1 and Table 2. Some columns are the same in both. I would like to pull the data depending on whether the column in table2 has an entry or not. I mean, if a data has an entry one of the column in both tables, then I would like to pull data from table2 if not table 1.
Following is the example of the table structure.
TABLE 1 : Ticket_details
TIcketID| SubmittedBy|Priority| Ticket_description|current_status
2010 1000 High blah...blah current_assigned
2020 1000 Normal gggggggggg current_assigned
2030 1100 Low hhhhhhhhhhhh current_description
TABLE 2: TICKET_EDIT_DETAILS
TIcketID| Priority| Ticket_description|
2020 Low gggggggggghhhh
In this example, the ticketId
2020 has an entry in Table2. So I would like to pull Priority
and ticket_description
from Table 2. But TicketIds 2010 and 2030 have no entry in Table 2, so I would like to pull the columns Priority
and ticket_description
from Table 1.
How can I do this?