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

  • SEARCH
  • Home
  • 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 914873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:47:27+00:00 2026-05-15T17:47:27+00:00

This should be simple Im just not getting the desired result, i’ve tries this

  • 0

This should be simple Im just not getting the desired result, i’ve tries this a couple of ways and still not getting anywhere I need to get the total cound of records of the subquery I know this is totally wrong but when but when I put the count on the subquery it still gives me 1 here’s my code:

SELECT COUNT(*) [COUNT] 
    (
        SELECT WP_BlogEntries.BlogEntryID, sys_Objects_Tags.TagID
        FROM WP_BlogEntries INNER JOIN sys_Objects_Tags ON
        WP_BlogEntries.BlogEntryID = sys_Objects_Tags.SystemObjectRecordID
        WHERE WP_BlogEntries.ReleaseDate < GETDATE()
        AND WP_BlogEntries.ExpireDate > GETDATE()
        AND WP_BlogEntries.Approved = 1
        AND WP_BlogEntries.Listed = 1
        AND WP_BlogEntries.BlogID = @BlogID
        AND TagID = @TagID
        GROUP BY WP_BlogEntries.BlogID, BlogEntryID, sys_Objects_Tags.TagID
    )
  • 1 1 Answer
  • 1 View
  • 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-05-15T17:47:28+00:00Added an answer on May 15, 2026 at 5:47 pm
    SELECT COUNT(*) As [COUNT] 
    From (
        SELECT WP_BlogEntries.BlogEntryID, sys_Objects_Tags.TagID
        FROM WP_BlogEntries 
            INNER JOIN sys_Objects_Tags 
                ON WP_BlogEntries.BlogEntryID = sys_Objects_Tags.SystemObjectRecordID
        WHERE WP_BlogEntries.ReleaseDate < GETDATE()
            AND WP_BlogEntries.ExpireDate > GETDATE()
            AND WP_BlogEntries.Approved = 1
            AND WP_BlogEntries.Listed = 1
            AND WP_BlogEntries.BlogID = @BlogID
            AND TagID = @TagID
        GROUP BY WP_BlogEntries.BlogID, BlogEntryID, sys_Objects_Tags.TagID
        ) As Z
    

    You simply need to alias the subquery and put it into the FROM clause making it into a derived table. Although, if all you want is the count, you don’t need anything in the Select clause (i.e., you could use Select 1 in the subquery’s Select clause and it’d still work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys this should be simple, I'm just not seeing it, I would like
This should be a simple answer. I'm just not knowledgeable enough in CSS to
This should be a simple question, but I just can't recall the relevant API.
This should be a simple question, but I just can't seem to figure it
Just starting out, this should be a simple one but I haven't been able
This task should be quite simple, but nothing I tried has worked. I'm just
This should be simple, but I'm getting confused. I have a parent/child tables -
This should be simple task but i am not been able to find the
This should be super simple, but I'm not sure why the compiler is complaining
This seems like it should be really simple, but for some reason, I'm not

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.