`select ... where ... in (...)` display incorrectly
Table `user_groups` has only 2 columns: `user_id`, `group_id`
I have 3 different user_id: 100111, 100112, 100113
User 100111 belongs to 446 different groups, and users 100112 and 100113 are inserted as below:
DELETE FROM user_groups WHERE user_id = '100112';
DELETE FROM user_groups WHERE user_id = '100113';
INSERT IGNORE INTO user_groups (user_id, group_id)
SELECT '100112' AS user_id, group_id FROM user_groups WHERE user_id = '100111';
INSERT IGNORE INTO user_groups (user_id, group_id)
SELECT '100113' AS user_id, group_id FROM user_groups WHERE user_id = '100111';
But when I use the statement `SELECT * FROM user_groups WHERE user_id in ('100111', '100112', '100113')` it shows 446 records for user 100111 but only 54 for user 100112. Then for user 100113, it is not displayed. I clicked the icon used "Local Filter For `user_id`" and it shows neither.
While `SELECT * FROM user_groups WHERE user_id = ...` all show the full 446 records for each user.
It takes me a lot of time to research why my code doesn't work well it shows only 54 records.
For security reasons, I cannot upload the attached photos.
___
PhpStorm 2024.1.4
Build #PS-241.18034.69, built on June 21, 2024
Licensed to …
Subscription is active until January 28, 2025.
Runtime version: 17.0.11+1-b1207.24 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.5.0-41-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 3970M
Cores: 20
Registry:
run.processes.with.pty=TRUE
ide.experimental.ui=true
Non-Bundled Plugins:
ru.adelf.idea.dotenv (2024.1)
Current Desktop: ubuntu:GNOME
___
DBMS: MySQL (ver. 8.0.36-28 (ProxySQL))
Case sensitivity: plain=exact, delimited=exact
Driver: MySQL Connector/J (ver. mysql-connector-j-8.2.0 (Revision: …), JDBC4.2)
Please sign in to leave a comment.