我希望能够在trybe中获得碎片证据。但我必须通过野心表,这是从trybe到证据的关系。
所以基本上从
获得计数(e.id)我目前的查询如下:
$evidence = array(1,2,10,20,40,60,80,100,200,300,400,500,1000,1500,2000);
$evidence = implode(", ", $evidence);
# no of evidence in trybe = the x trybe now has over x evidence
$query = sprintf("SELECT t.id, t.name, COUNT(e.id) as number, 'trybe_evidence' AS type
FROM x_trybes t
INNER JOIN x_ambition_owner ao ON (t.id = ao.trybe_id)
LEFT JOIN x_evidence e ON (ao.id = e.ambition_id)
GROUP BY t.id, t.name
HAVING COUNT(e.id) in (%s)",$evidence);
如何从trybe表中的所有野心中获取所有证据?
表的结构如下:
x_trybes
id name
x_ambition_owner
id ambition_id trybe_id
x_ambition - 野心信息
id name etc.
x_evidence
id ambition_id name
请注意,可能有许多试验,许多野心和许多证据。
由于