0

i have table groupLocal:

id nameGroup group
1 group A [1,2]
2 group B [2,3]

and table customer:

id nameCustomer local
1 Jerry 1
2 Tom 2
3 Nan 2
4 Bie 3

i want result count customer.local with condition customer.local in groupLocal.group

id nameGroup count(customer.local)
1 group A 3
2 group B 3

Thank U

7
  • 2
    is that group column a varchar or json column? if its a json column, its been answered before Commented Dec 29, 2023 at 15:52
  • 1
    It's generally better to normalize your design instead of putting a list in a column. See stackoverflow.com/questions/3653462/… Commented Dec 29, 2023 at 15:58
  • what is in groupLocal.group? are those customer.local values? can you explain what you are counting? how is the count for group B 2? Commented Dec 29, 2023 at 20:05
  • @BagusTesa it is json Commented Dec 30, 2023 at 3:36
  • @ysth yes, it's 3, I updated it again. Commented Dec 30, 2023 at 3:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.