How to combine 2 mysql queries -


i have following 2 queries.

query 1 :  select distinct(thread_id) records client_name='myclient'  query 2 : select max(thread_no) records  thread_id='loop_result_from_above_query' , action='reviewed' 

is possible combine them single query ?

the second query run on every result of first query.

thank you.

see attached image of small snippet of mysql records. enter image description here

i need single mysql query output records have action="myaction" latest records given set of thread_ids. in sample data set : record sr: 7201

i hope helps in helping me :)

select  client_name, thread_id, max(thread_no) max_thread    records   action='reviewed' , client_name='myclient' group   client_name, thread_id 

update 1

select  a.*    records         inner join         (             select  thread_id, max(sr) max_sr                records             group   thread_id         ) b on a.thread_id = b.thread_id ,                 a.sr = b.max_sr   a.action = 'myaction' 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -