我有以下的JS对象:复杂的SQL查询JavaScript对象
var groups = [{id="4", name="abcd", id_group="1"},
{id="5", name="efgh", id_group="1"},
{id="6", name="ijkl", id_group="1"},
{id="4", name="abcd", id_group="2"},
{id="7", name="mnop", id_group="2"}]
,我需要上述对象上执行此SQL查询:
select id_group from groups where id in (4,7)
group by id_group having count(distinct id) = 2
的结果应该是:
id_group="2"
,因为只有该组包含在查询中使用的两个ID。
我发现了大约SQLike和JSLINQ资料,但我已经在和有表达式中遇到的问题与哪里。有没有可能在JavaScript对象上使用SQL-JS库或JS/jQuery本身执行此类查询(编写函数等)?