Here is a query that is giving me an error
[code]
SELECT a.wine_num, a.activity, date_format(a.date_posted,’%m-%d-%y’) as date_mdy, d.activity_desc, a.bottle_cnt, a.my_comments, w.label, w.vintage, CONCAT(s.sort_date, s.wine_num) as sort_col
FROM mywines_activity a, mywines_activity_codes d, mywines w
LEFT OUTER JOIN (select wine_num, max(date_posted) as sort_date
from mywines_activity
group by wine_num) s
on a.wine_num = s.wine_num
WHERE $sel_wine
a.activity = d.activity_code and
a.wine_num = w.wine_num
ORDER BY sort_date Desc, a.wine_num
The message is that ‘a.wine_num’ in the ON clause of my join does not exist. The query works fine without the join, so I can’t figure this out.
Here’s the actual message:
Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘a.wine_num’ in ‘on clause’ in /home/albany/public_html/homejg/wine_activity_review.php:103 Stack trace: #0 /home/albany/public_html/homejg/wine_activity_review.php(103): PDO->prepare(‘SELECT a.wine_n…’) #1 {main} thrown in /home/albany/public_html/homejg/wine_activity_review.php on line 103
Any ideas?