adding count( ) column on each row
        Posted  
        
            by Arsenal
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Arsenal
        
        
        
        Published on 2010-05-20T11:17:15Z
        Indexed on 
            2010/05/20
            11:20 UTC
        
        
        Read the original article
        Hit count: 174
        
I'm not sure if this is even a good question or not.
I have a complex query with lot's of unions that searches multiple tables for a certain keyword (user input). All tables in which there is searched are related to the table book.
There is paging on the resultset using LIMIT, so there's always a maximum of 10 results that get withdrawn.
I want an extra column in the resultset displaying the total amount of results found however. I do not want to do this using a seperate query. Is it possible to add a count() column to the resultset that counts every result found?
the output would look like this:
ID    Title    Author    Count(...)  
1     book_1   auth_1      23  
2     book_2   auth_2      23  
4     book_4   auth_..     23  
...
Thanks!
© Stack Overflow or respective owner