Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:48:11+00:00 2026-06-02T05:48:11+00:00

Lets assume I have this sql query SELECT max(times_viewed) as m, member_id, (select count(viewed_url)

  • 0

Lets assume I have this sql query

SELECT max(times_viewed) as m, member_id, (select count(viewed_url) from exp_member_page_tracker  where member_id=mpv.member_id)
FROM `exp_member_page_tracker` mpv
group by member_id

I need to count all results. I do it on this way

SELECT count(member_id) from ( SELECT max(times_viewed) as m, member_id, (select count(viewed_url) from exp_member_page_tracker where member_id=mpv.member_id)
FROM `exp_member_page_tracker` mpv
group by member_id) as m2

But I am not sure how that is efficient. Could you please suggest me how can I count results in the best way?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:48:13+00:00Added an answer on June 2, 2026 at 5:48 am

    For your subquery, am I missing something, Isn’t this same result with more effiency?
    Tryed at sqlfiddle:

    http://sqlfiddle.com/#!2/a03cf/9

    Yours:

    SELECT member_id, max(times_viewed) as max_times_viewed 
    , (select count(viewed_url) from exp_member_page_tracker  where member_id=mpv.member_id) as countOfViewedUrl
    FROM `exp_member_page_tracker` mpv
    group by member_id;
    

    Alternative:

    SELECT member_id, max(times_viewed) as max_times_viewed
    , count(viewed_url) as countOfViewedUrl
    FROM `exp_member_page_tracker` mpv
    group by member_id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets assume i have a query like the following $query_search = SELECT * FROM
Lets assume we have this xml: <?xml version=1.0 encoding=UTF-8?> <tns:RegistryResponse status=urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure xmlns:tns=urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0 xmlns:rim=urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0> <tns:RegistryErrorList
Lets assume we have a table with a fulltext field on it. This field
Lets assume I have this sample data: | Name | ID | PARENT_ID |
So I have this piece of code, and let's assume I'm filling out a
Lets assume I have the following 3 entities: Customer,Order,Product which interact in the View
Lets assume we have a class car. How would You name parameters of function
Lets assume we have the following code: abstract class Base1 { protected int num;
Lets assume I have two hashes. One of them contains a set of data
Lets assume i have a bill number that has 12 numbers: 823 45678912 My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.