Nelze zobrazit vysledek
SELECT x.pid, x.sid, x.uid, j.jid, k.kid, o.oid,
jc.licence lic_jezdce, coalesce(j.jmeno, jc.jmeno, x.jmeno) jmeno,
coalesce(j.prijmeni, jc.prijmeni, x.prijmeni) prijmeni,
kc.licence lic_kone,
x.cislokone,
coalesce(k.kun, kc.kun, x.kun) kun,
oc.lic_odd,
coalesce(oc.oddil, o.oddil, x.oddil) oddil,
x.present, x.placeno, w.popis, x.startovne, x.vlozeno, x.wannabe,
x.pf*x.nk as mtm, floor(x.ps) as ps, x.px, @rownum := @rownum + 1 as por
FROM (SELECT p.*, coalesce(p.ps, 999) as px, CASE WHEN ((SELECT MIN(p1.pid)
FROM prihlas as p1 WHERE p.prijmeni = p1.prijmeni AND p.jmeno = p1.jmeno AND p1.
sid = p.sid ) = p.pid && (SELECT COUNT(*) FROM prihlas as p1 WHERE p.prijmeni =
p1.prijmeni AND p.jmeno = p1.jmeno AND p1.sid = p.sid ) + (SELECT COUNT(*) FROM
prihlas as p1 WHERE p.kun = p1.kun AND p1.sid = p.sid ) > 2) THEN -1 WHEN ((
SELECT MAX(p1.pid) FROM prihlas as p1 WHERE p.prijmeni = p1.prijmeni AND p.
jmeno = p1.jmeno AND p1.sid = p.sid ) = p.pid && (SELECT COUNT(*) FROM prihlas
as p1 WHERE p.prijmeni = p1.prijmeni AND p.jmeno = p1.jmeno AND p1.sid = p.sid )
+ (SELECT COUNT(*) FROM prihlas as p1 WHERE p.kun = p1.kun AND p1.sid = p.sid )
> 2) THEN 1 ELSE 0 END AS pf,
(SELECT COUNT(*) FROM prihlas as p1 WHERE p.prijmeni = p1.prijmeni AND p.jmeno =
p1.jmeno AND p1.sid = p.sid ) + (SELECT COUNT(*) FROM prihlas as p1 WHERE p.kun
= p1.kun AND p1.sid = p.sid ) as nk
FROM prihlas as p
WHERE 1=1
AND p.sid = 1398
) as x
LEFT JOIN jezdci j ON x.jid = j.jid
LEFT JOIN jezdcicjf jc ON x.lic_jezdce = jc.licence
LEFT JOIN kone k ON x.kid = k.kid
LEFT JOIN konecjf kc ON x.lic_kone = kc.licence
LEFT JOIN oddil o ON x.oid = o.oid
LEFT JOIN oddilcjf oc ON x.lic_odd = oc.lic_odd
LEFT JOIN wannabe w ON x.wannabe=w.wid
, (SELECT @rownum:=0) as r
WHERE x.uid =
ORDER BY x.px, x.pf*x.nk, x.wannabe, x.vlozeno DESC
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY x.px, x.pf*x.nk, x.wannabe, x.vlozeno DESC' at line 39
/data/web/virtuals/43241/virtual/www/mujklub2/knihovna.php, 102