Hello Jørn Dahl-Stamnes,
The column 'fee' is existing in more than one table . To overcome this problem use the correct instance name of the table for the column "fee" In WHERE clause

select
   s.id,
   s.name,
   sum(p.fee) as fee
    from serie as s
inner join race_serie as   rs
    on (rs.serie_id=s.id)
inner join races as r
    on (r.id=rs.race_id)
inner  join participants as p
   on (p.race_id=r.id)
where s.receipt=1 and
p.rider_id=236 and  p.fee > 0  ---- Here  p is the instance of the table
participants
group by s.id order by s.f_date;


Thanks
VisolveDB Team

----- Original Message ----- From: "Jørn Dahl-Stamnes" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Sunday, July 30, 2006 2:40 PM
Subject: Problems with WHERE clause


I got the following query:

select s.id,s.name,sum(p.fee) as fee from serie as s inner join race_serie as
rs on (rs.serie_id=s.id) inner join races as r on (r.id=rs.race_id) inner
join participants as p on (p.race_id=r.id) where s.receipt=1 and
p.rider_id=236 and fee > 0 group by s.id order by s.f_date;


which gives me the error:

ERROR 1052 (23000): Column 'fee' in where clause is ambiguous


Without the 'and fee > 0' the query works fine.


mysql> select version();
+----------------+
| version()      |
+----------------+
| 4.1.8-standard |
+----------------+


Is this due to an old version of MySQL?

--
Jørn Dahl-Stamnes
homepage: http://www.dahl-stamnes.net/dahls/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to