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

The Archive Base Latest Questions

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

So far I got it working with a subselect, but some research told me

  • 0

So far I got it working with a subselect, but some research told me it is bad to be using subselects (especially on large tables) as they are less performant.

Now that’s what I got:

SELECT COUNT( riddims.riddim ) AS rc, 
(
    SELECT COUNT( tunes.tune )
    FROM tunes
    WHERE tunes.tune NOT
    IN (
        ''
    )
) AS tc
FROM riddims
WHERE riddims.riddim NOT
IN (
    ''
)

The tables look something like:

riddims:
riddim | genre | image

tunes:
riddim | artist | tune

I was playing around with ‘JOIN’ but couldn’t realy figure a working query out. What I’d need is something similiar to STACKOVERFLOW COUNT FROM MULTIPLE TABLES in a more performant way than my above solution.

My goal is to perform a query that shows following output:

riddims | tunes | artist
100     | 400   | 2
  • WHERE riddims NOT IN (”)
  • WHERE tunes NOT IN(”)
  • WHERE artist = ‘some artist’

This is how I started but its obviously going into the wrong direction:

SELECT COUNT(riddims.riddim) AS rc, COUNT(tunes.tune) AS tc FROM riddims LEFT JOIN tunes ON riddims.riddim = tunes.riddim
  • 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-11T05:16:02+00:00Added an answer on June 11, 2026 at 5:16 am

    Are you trying to do this:

    select riddims, tunes, artists
    from (select count(*) as riddims from riddims where . . . ) r cross join
         (select count(*) as tunes from tunes where tunes not in  . . .) t cross join
         (select count(*) as artists from tunes where artist not in . . .) a
    

    Your tables don’t seem to be connected, at least for this query. The possible performance issue is that the subqueries in your select are being called once for each row. By putting them in the FROM clause, you eliminate this possible problem.

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

Sidebar

Related Questions

I'm working on creating a 3D landscape. So far I've got a mesh created
Here is what I've got so far.. I'm using this as a keybind. I
im trying to get multi texturing working and have so far got miltiple textures
hey ive got a working php script, and as far as i can tell
So I've got this working so far: <script type=text/javascript> window.addEvent('domready', function() { $('casestudies').addEvent('click', function(
I've got a working SOAP::Lite client. It works against an established server, but so
I'm working with the Google Maps Geocoder. I've got everything working fine, but I
I am just starting with Sphinx. So far I got it installed successfully, got
I am trying to recreate the Notes application. So far I got the following:
I got this far: :~ curl -u username:password -d status=new_status http://twitter.com/statuses/update.xml Now, how can

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.