Jump to content

How to count records from different tables


Yvalson
 Share

Recommended Posts

So I'm trying to filter some records out of my select inside a form on my website.
Problem is that I currently have this setup:

Database
   Table1
      Time
      Number
   Table2
      Number
      Something

I'm trying to filter time by checking how many records show up of number in table2 
So basically I select time from table1 where number is less than <some amount> in table2

How do I actually put that in sql? I currently have this  but it isn't working:

    SELECT Time FROM Showcase WHERE  Number IN (SELECT COUNT(Number) 
    FROM Build WHERE COUNT(Number) < 50);

it currently doesn't end up with anything but in theory it should show the times from the records where the count of the value of number is less than 50

so if Number = 40 and it gets counted 70 times it shouldn't show up.

but if Number = 30 is counted 29 times it should show up

can anyone tell me what is going wrong?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...