Skip to content
Advertisement

How to show only those sellers who have created at-least one product

I have one sellers table where sellerid column is sno and I have products table where sellerid is sellerid , I want to get those sellers who are not blocked (there is column named flag in sellers table) and have created at least one product so I write this(or maybe copy this)

JavaScript

Now I do my logic through:

JavaScript

It is producing incorrect result

Advertisement

Answer

JavaScript
JavaScript
sno flag count
1 0 2
2 0 1
3 0 1
JavaScript
sno flag count
1 0 2
2 0 1
3 0 0
JavaScript
sno flag count
1 0 2
2 0 1

db<>fiddle here

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement