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 6115291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:04:27+00:00 2026-05-23T15:04:27+00:00

SELECT COUNT( WiningComment) AS ‘WinningAnswers’ FROM Threads WHERE WiningComment IN (SELECT CommentsID FROM Comments

  • 0
SELECT COUNT( WiningComment) AS 'WinningAnswers'
FROM Threads
WHERE WiningComment IN (SELECT CommentsID
FROM Comments
WHERE  UsersID=@UserID)

UNION ALL
SELECT COUNT(CommentsID)  AS 'TotalAnswers'
FROM  Comments
WHERE  UsersID=@UserID

I want TotalAnswers and WinningAnswers to appear as two seperate columns. But instead I get one row with two figures when I test the query…

  • 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-05-23T15:04:28+00:00Added an answer on May 23, 2026 at 3:04 pm
    SELECT (
        SELECT COUNT( WiningComment)
        FROM Threads
        WHERE WiningComment IN (SELECT CommentsID
        FROM Comments
        WHERE  UsersID=@UserID)
    ) as 'WinningAnswers',
    (
        SELECT COUNT(CommentsID)
        FROM  Comments
        WHERE  UsersID=@UserID
    ) as 'TotalAnswers'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SELECT COUNT(Field1_) FROM ( SELECT Field1_ FROM Table1_ WHERE Field1_= @Field1 UNION ALL SELECT
SELECT COUNT(*) as totalHappenings FROM `happenings` WHERE `userId` = ? UNION SELECT COUNT(*) as
select NV.PHG From Nhanvien NV Group by NV.phg Having count(nv.Manv) >= all (select count(NV.MANV
$sql = select count(userId) from tblUser; $result=mysql_query($sql,$link)or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_NUM); echo $row[1];
$query = SELECT COUNT(t.id), SUM(t.num_replies) FROM threads AS t WHERE t.forum_id=$forum_id; $result = mysql_query($query);
SELECT * FROM( (SELECT count(DISTINCT RECEPIENT_ID) as NoOfUsers, TO_CHAR(ACTN_TAKE_DATA_TM,'YYYY-MM-DD') as accDate FROM ALRT_PLATFORM_ALRT_HSTRY where
TOPIC_COUNT_SQL = SELECT COUNT(*) FROM topics_topic WHERE topics_topic.object_id = maps_map.id AND topics_topic.content_type_id = %s
When we execute select count(*) from table_name it returns the number of rows. What
In this query: SELECT COUNT(*) AS UserCount, Company.* FROM Company LEFT JOIN User ON
i develop this code: SELECT COUNT(NewEmployee.EmployeeID), NewEmployee.EmployeeId,EmployeeName FROM NewEmployee INNER JOIN NewTimeAttendance ON NewEmployee.EmployeeID

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.