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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:52:34+00:00 2026-05-26T17:52:34+00:00

So I have the following SELECT statements: SELECT COUNT(A.Award) AS US, SUBSTRING(CAST(M.Year as char(4)),

  • 0

So I have the following SELECT statements:

SELECT COUNT(A.Award) AS US, SUBSTRING(CAST(M.Year as char(4)), 0 , 4)  AS Decade
FROM Movies M, Awards A
WHERE {SOME WHERE CLAUSE}
GROUP BY Decade;

and

SELECT COUNT(*) AS Total, SUBSTRING(CAST(A2.Year as char(4)), 0 , 4) AS Decade
FROM Awards A2
WHERE {SOME WHERE CLAUSE}
GROUP BY Decade;

The first one is “generating” a table with columns (US, Decade) and the second one is “generating” another table with columns (Total, Decade). I want to join those two tables so that I get a table (US, Total, Decade). How can I do it?

  • 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-26T17:52:35+00:00Added an answer on May 26, 2026 at 5:52 pm

    Put them in subqueries and do a JOIN:

    SELECT a.US, a.decade, b.total FROM
    
      (SELECT COUNT(A.Award) AS US, SUBSTRING(CAST(M.Year as char(4)), 0 , 4)  AS Decade
      FROM Movies M, Awards A
      WHERE {SOME WHERE CLAUSE}
      GROUP BY Decade ) AS a
    
    INNER JOIN
    
      (SELECT COUNT(*) AS Total, SUBSTRING(CAST(A2.Year as char(4)), 0 , 4) AS Decade
      FROM Awards A2
      WHERE {SOME WHERE CLAUSE}
      GROUP BY Decade) AS b
    
    ON a.decade = b.decade
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have following procedure syntax working : select count(1) from from ( select id,
I have the following SQL: SELECT *, (SELECT COUNT(*) FROM WebOrder_URLHistory WHERE WebOrder_URLHistory.LeadID =
I have the following sql statement: select val, count(*) as tally from sometable group
I have the following code: SELECT c.c_id, c_name, count(h.h_id) AS count FROM c LEFT
I have the following sql statement: SELECT COUNT(table2.programName), table2.programName FROM table1 LEFT JOIN table2
I have following MySQL query: (SELECT c.Channel as name, count(*) as total_episode FROM (
I have the following MySQL query statement: SELECT * FROM table1 INNER JOIN table2
Can I have a prepared statement with the following query: select * from table
I have following select results: Select t1.ID, t1.Value1 from t1 where t1.ID=1 Result: ID
I am trying to do prepared statements as follows: $stmt = $mysqli->prepare(SELECT COUNT(*) FROM

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.