Skip to content
Advertisement

Category: Questions

How to compare counts from subselect?

I want to compare the count between two tables. Or more to say, output if the count from table1 is greater than from table2: SELECT c1 > c2 FROM (SELECT count(*) from table1) as c1, (SELECT count(*)…

Provide array of ids and get rows with repeated rows

I have the table where I wand to do a query to get same rows multiply times Races Table: id name location 1 fast race London 2 cool race New York 3 super race Berlin I want to do query where I will search races in table by id and get results with repeated rows something like this And get

LIMIT 1 by Column On Query Returning Multiple Results?

I have a user_certifications table, with these props: So, a user can be listed multiple times with a variety of certs. I have a list of user_ids for which I need to get ONLY the most recently updated record. So for one user it would be: How do I do this efficiently if I need ONLY the last dated entry

sql find parent table where sum of child column not equal to parent column

hey guys i am trying to find the a bill from billMaster where the sum of billDetails.total is not equal to billMaster.remainingAmount NB this is a one to many relationship where one bill can contain more billdetails i tried the below query and got an sql error both queries returned the same error i gess its on how i used

Advertisement