select distinct p.ID,p.post_title,p.post_name,p.post_date,p.guid
from 5gstore_blog.wp_posts p join 5gstore_blog.wp_term_relationships tr on p.ID=tr.object_id
join 5gstore_blog.wp_term_taxonomy tt on tr.term_taxonomy_id=tt.term_taxonomy_id
join 5gstore_blog.wp_terms t on tt.term_id=t.term_id
where p.post_type='post' and p.post_status='publish' and tt.taxonomy='post_tag'
and t.name in ('170676-000','CradlePoint')
order by IF(t.name='170676-000',0,1) asc,p.post_date desc limit 5