Display sql sum of two counts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fran7
    New Member
    • Jul 2006
    • 229

    Display sql sum of two counts

    Hi, I wonder if anyone had a pointer for the following.


    I have a main query that includes a count of visitor clicks to external websites below

    Code:
    SQLQuery= SQLQuery & "left outer join(select link_id, count(link_id) results from tblLinkTrackerLogs  group by link_id) S on P.profileId = S.link_id "
    At the time I also count the number of times websites are saved to user accounts. I was wondering if its possible to display results by the sum of the two tables totals and displaying the highest first. Something along these lines.

    Code:
    order by sum(results) + sum(other_table) desc
    Thanks in advance.
    Richard
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Yes, you can do that.

    Comment

    Working...