更新:感謝你感到沉淪,事情現在有了這個查詢的工作100%:MYSQL DISTINCT ORDER BY不給予正確的順序
SELECT e.entry_id
FROM exp_channel_titles AS e
INNER JOIN exp_matrix_data AS m ON m.entry_id = e.entry_id
WHERE e.channel_id = 2
GROUP BY e.entry_id
ORDER BY MIN(m.col_id_2) ASC
這裏是我的代碼。
從.home_laagste_rentes代碼從頁面
{exp:channel:entries dynamic="no" fixed_order="0{embed:entry_ids}" disable="member_data|pagination|categories"}
<tr class="{switch="odd|even"}">
<td><a href="#" title="{title}">{title}</a></td>
<td>{dk:lowest col="rente" decimals="2" dec_point=","}%</td>
<td>{count}</td>
</tr>
{/exp:channel:entries}
代碼:
<table id="rowspan" cellspacing="0" class="tablesorter">
<thead>
<tr>
<th>Krediet aanbieder</th>
<th>Rente</th>
<th>Beoordeling</th>
</tr>
</thead>
<tbody>
{embed="embeds/.home_laagste_rentes"
entry_ids="{exp:query sql="
SELECT DISTINCT (e.entry_id)
FROM exp_channel_titles AS e
INNER JOIN exp_matrix_data AS m ON m.entry_id = e.entry_id
WHERE e.channel_id = 2
ORDER BY m.col_id_2 ASC
"}|{entry_id}{/exp:query}"}
</tbody>
col_id_2被設置爲十進制(10,4)
entry_id設置爲INT
這正在過濾重複,但它沒有給出正確的順序。它看起來像過濾重複是隨機完成...看到這個鏈接輸出: http://postimage.org/image/9vzahuuez/
不是創建一個鏈接表查詢..請張貼孔查詢 – rauschen
喜Rauschen,只是更新了完整的代碼.. –
@TVoskuilen你可以發佈表'exp_channel_titles'和'exp_matrix_data'的SCHEMA嗎? –