Subject Re: [firebird-support] error with query on 3+1 tables with COUNT and MIN
Author Gary Benade
> COUNT(of.id)
You are using 'of' as a table alias but it is a reserved word. Change it to
something else.

Regards
Gary


----- Original Message -----
From: "Michal Žeravík" <michalz@...>
To: <firebird-support@yahoogroups.com>
Sent: Monday, November 22, 2004 2:19 PM
Subject: [firebird-support] error with query on 3+1 tables with COUNT and
MIN


>
> 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
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>