我有一个数据库,我有一些记录。我想显示按 ordNR 分组的所有记录,我该怎么做?
SELECT Group_concat(ordnr) ordNR,
koden,
Group_concat(wish) wish,
rnamn,
bild,
pris,
cname,
onsktext,
restidn
FROM (SELECT m.ordnr AS ordNR,
p.id AS restidn,
t.tabnum AS tabNum,
m.wishtext AS onsktext,
m.meaoid AS midn,
m.ordcode AS koden,
w.wish,
r.meaname AS rnamn,
r.meaimg AS bild,
r.meaprice AS pris,
k.catname AS cname
FROM cats k,
meals r,
tables t,
restaurant p,
wishes w,
meaorder m
JOIN orders c
ON c.ordnr
WHERE p.id = '3'
AND c.tabid = t.tabid
AND c.ordstatus = '0'
AND m.ordnr = c.ordnr
AND m.meaid = r.meaid
AND m.wishesid = w.id
AND r.catid = k.catid)T
GROUP BY koden,
rnamn,
bild,
pris,
cname
ORDER BY midn DESC