ID ID_ENTITY ID_TICKET C_ENUM VAL2 VAL3
1 680 460910 quack
2 680 460910 65536
3 680 460910 text
4 680 460909 quack
5 680 460909 65536
6 680 460909 text
7 680 460908 quack
8 680 460908 65535
9 680 460908 text
I have SQL to get "ID_TICKET" where "C_ENUM" = 'quack':
select "ID_TICKET"
from "T_TICKET_TYPE_ENTITY_VALUE"
where "ID_ENTITY" = 680 and "C_ENUM" = 'quack'
But I need to get all "ID_TICKET" where "C_ENUM" = 'quack' AND, for example, VAL2 = 65536.
Something like this:
select "ID_TICKET"
from "T_TICKET_TYPE_ENTITY_VALUE"
where "ID_ENTITY" = 680 and "C_ENUM" = 'quack' and "VAL2" = 65536
How can I do this?
Full query which I'm trying to do:
select t."ID"
from "T_TICKET" t
join "T_TICKET_TYPE_ENTITY_VALUE" entv on entv."ID_TICKET" = t."ID"
join "T_TICKET_TYPE_ENTITY" ent on ent."ID" = entv."ID_ENTITY"
where t."ID_STATUS" != 13 and ent."ID_TICKET_TYPE" = 462
and entv."C_ENUM" = 'quack'
ID_ENTITYfrom the where criteria.select "ID_TICKET" from "T_TICKET_TYPE_ENTITY_VALUE" where "C_ENUM" = 'quack'