I have 2 tables:
- category(
inter_archi_cattable) and their linking with other - entities(
inter_architable )
I want to select only categories which linked to any entity.
SELECT *
FROM inter_archi_cat
WHERE id IN (SELECT GROUP_CONCAT(DISTINCT sub_cat) as allcat
FROM inter_archi)
If I ran the subquery individually, I’m giving correct results (apx 40 records). But while running with main query its giving only 1 record.
I have done it:
here is changed query:
got idea from
MySQL – How to use subquery into IN statement by value