sql - select mutiple rows from single column -


i have 2 tables tickets , tickets events

tickets

t-number  t_street, t_zone,name 888        xyz           abc 999         ddd          rrr 1000        eee          fff  

tickets _events

te_system_ref    te_event_code te_event          te_userid 888               13000         off hold          autodrop 888               11000         disocunt          autodrop 888               10000         on hold              autodrop 999                13000        offfhold          smrithi 1000               11000        disocunt          keerthi 

i need find out te_system_ref has both the te_events 13000 , 11000

select  *   ticket_events    inner join tickets b on  b.t_number = a.te_system_ref       te_event_code = '13000'  , //te_event_code in('13000','11000') or te_event in ('off hold' , 'disocunt')   te_userid = 'autodrop'   

you can do

select te_system_ref ickets _events te_event_code in('13000','11000')       , te_userid = 'autodrop' group te_system_ref having count(*)=2 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -