Arrange mysql Join results in a number sequence

I made a query to get all post in a category in wordpress . I have used JOIN for that and i wanted to arrange all post in a sequence increment created in a new field .

My query is

SELECT * FROM wp_posts p
LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID
LEFT OUTER JOIN wp_term_taxonomy x ON x.term_taxonomy_id = r.term_taxonomy_id
LEFT OUTER JOIN wp_terms t ON t.term_id = x.term_id
WHERE p.post_status = 'publish'
AND p.post_type = 'post'
AND t.slug = 'goat' 

The result i am expecting is

row_count  id    title

   1       45     Example 
   2       67     Example 2
   3       104    Example 3 


Well how about doing it the wordpress way. I haven't tested it yet, might need a few tweeks but it should get your your required results.

$args = array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'orderby' => 'id', 
    'order' => 'ASC'

    'tax_query' => array(
            'taxonomy' => 'taxonomy-slug',
            'field'    => 'slug',
            'terms'    => 'taxonomy-term',
    query_posts(  $args );

     if ( have_posts() ) {
       echo '<table>'; $count= 1;
        while ( have_posts() ) : the_post();
            echo '<tr>';
            echo '<td>'.$count.'</td>';
            echo '<td>'.get_the_id().'</td>';        
            echo '<td>'.get_the_title().'</td>';
            echo '</tr>'; 

       echo '</table>';


Need Your Help

ARToolKit on ubuntu

opengl ubuntu glut augmented-reality artoolkit

I have been trying to setup ARToolkit on my UBUNTU 11.10 pc.The problem i am facing it that it requires GLUT/OpenGL lib and SDK and i am not able to figure out how to do that.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.