Subject | error with query on 3+1 tables with COUNT and MIN |
---|---|
Author | Michal Žeravík |
Post date | 2004-11-22T12:19:42Z |
Hi, I'm getting error message
Dynamic SQL Error SQL error code = -104 Token unknown - line 3, char 57 of
on query:
SELECT
n.*, n.datefinish-'NOW' rest, (n.datefinish-n.datestart) len,
u.compname, c.nazevcz, c.nazeven, c.nazevde,
COUNT(of.id) offers, MIN(of.price) bestprice
FROM
needbox n, user u, category c
LEFT JOIN
offers of ON (of.nbid=n.id)
WHERE
n.userid=u.userid AND c.id=n.catid AND c.isactive=1 AND n.userid=?
AND u.isactive=1 AND 'NOW'>=n.datestart AND 'NOW'<=n.datefinish
GROUP BY n.id
ORDER BY rest ASC;
I need to list offers for needbox request with category and user name
and number of offers (childs) and their lowest price.
Any ideas?
Thanx
Michal
Dynamic SQL Error SQL error code = -104 Token unknown - line 3, char 57 of
on query:
SELECT
n.*, n.datefinish-'NOW' rest, (n.datefinish-n.datestart) len,
u.compname, c.nazevcz, c.nazeven, c.nazevde,
COUNT(of.id) offers, MIN(of.price) bestprice
FROM
needbox n, user u, category c
LEFT JOIN
offers of ON (of.nbid=n.id)
WHERE
n.userid=u.userid AND c.id=n.catid AND c.isactive=1 AND n.userid=?
AND u.isactive=1 AND 'NOW'>=n.datestart AND 'NOW'<=n.datefinish
GROUP BY n.id
ORDER BY rest ASC;
I need to list offers for needbox request with category and user name
and number of offers (childs) and their lowest price.
Any ideas?
Thanx
Michal