I have a table with EVENT_ID column its have multiple entries against this event_id and then have event_name column. so my requirement is I need to select couple event-name along with the finalized event records if the one of the event_name is finalized_Event and in the passed event_ids, otherwise ignore that event_id, is there any way I can combine all query in one SQL.
Select * from EVENT where EVENT_ID in ('0cbe3a81-8102-4eee-b8ef-07485f58cf0a','42b47725-4cc3-4620-9051-652d5409e69a','6e1b73d1-2f20-410c-80d2-89b0ccfde473')
and
( select * from EVENT where EVENT_NAME = 'FinalisedEvent' and (EVENT_NAME = 'CreatedEvent' or EVENT_NAME = 'DeletdEvent'))
Do you want something like:
SELECT e1.*
FROM EVENT e1
INNER JOIN EVENT e2
ON e1.EVENT_ID = e2.EVENT_ID
AND (e2.EVENT_NAME = 'CreatedEvent' OR e2.EVENT_NAME = 'DeletdEvent')
WHERE e1.EVENT_ID in ('0cbe3a81-8102-4eee-b8ef-07485f58cf0a','42b47725-4cc3-4620-9051-652d5409e69a','6e1b73d1-2f20-410c-80d2-89b0ccfde473')
AND e1.EVENT_NAME = 'FinalisedEvent'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.