I hope someone will help me.............
I have a
- Post Type ----> Dealers
- Taxonomy ----> State
how to write a sql query in this format
$catinfo1 = $wpdb->get_results("select t.*,(select count(tr.object_id) from $wpdb->term_relationships tr join $wpdb->posts p on p.ID=tr.object_id where tt.term_taxonomy_id=tr.term_taxonomy_id and p.post_status='publish') pcount from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"fueltype\" and tt.parent=0 order by t.name");