----------------------------
| user | path | active |
----------------------------
| user A | A.1 | 0 |
----------------------------
| user B | A.1.1 | 1 |
----------------------------
| user C | A.1.1.1 | 1 |
----------------------------
条件が含まれています。 ユーザBはユーザAの子であり、ユーザCはユーザBの子です。 アクティブな場合= 0はユーザがアクティブではないことを意味します。ネストされたSELECT MySQLのオペランドはすべき1列
私はアクティブで、子供を持つユーザーAの子供をパスで選択する必要があります。
は、今の私はすでに
が、今私は、ユーザAの子を選択する必要があり、それはユーザAのすべてのチャイルズを返します
select path from table where active = 1 and `path` like 'A.1%' and
length(`path`) - length(replace(`path`, '.', '')) = 2;
ユーザーの子を選択するクエリを持っている人子供もいます。
私はこの
select distinct path from table where active = 1 and user_type = 1 and `path` like ((select path from acctProgress_monthly where active = 1 and user_type = 1 and `path` like 'A.1%' and
length(`path`) - length(replace(`path`, '.', '')) = 2), '%');
などの選択ネストされたユーザーに試してみましたが、それは誤り
誰かがこの問題について私を助けることができる
おかげでたくさん
「オペランドが1列が含まれている必要があり」を返します