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

I'm just getting to grips with Doctrine, and using the suggested lazy loading of
Firstly: apologies if this is a duplicate post. Things got a bit confusing as
I'm attempting to make a simple homebrew game engine/framework in android. I have the
Update: I can't delete this question, because the answer has been upvoted, yet it
I've built a WCF Service in .NET 4.0 that basically just does standard CRUD
Good day. I'm using the WebClient class in my C# application in order to
Okay, here's the situation. I have two NSManagedObjects called Store and Aisle . There
I am trying to use URLLoader to load an XML file from server (same
I am working on a C# application and want to display dates so they
I have the beginnings of a jigsaw demo in SVG that works in Opera,

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.