Hello all, my first mysql posting. I've been a Sybase SQL Server programmer for 10 years and the following select I know I have to translate as MySQL does not support nested selects.
My version: mysql Ver 11.15 Distrib 3.23.41, for redhat-linux-gnu (i386) insert h2 select w.word,' ', 0 from words w, events e where e.word_id = w.word_id and e.leftseq = 1 and 0 = (select count(*) from words w2, events e2 where e2.url_id = e.url_id and e2.leftseq = 2 and w2.word_id = e2.word_id ) group by w.word; I've tried the following variants and they generate error messages: mysql> select w.word,' ',0 -> from words w, events e, LEFT JOIN events e2 on ( e.url_id = e2.url_id and e2.leftseq = 2) -> where e.word_id = w.word_id -> and e.leftseq = 1 -> and e2.url_id is NULL -> group by w.word; ERROR 1064: You have an error in your SQL syntax near 'LEFT JOIN events e2 on ( e.url_id = e2.url_id and e2.leftseq = 2) where e.word_' at line 2 mysql> insert h2 -> select w.word,' ',0 -> from words w, events e, LEFT JOIN events e2 on e.url_id = e2.url_id -> where e.word_id = w.word_id -> and e.leftseq = 1 -> and e2.leftseq = 2 -> and e2.url_id = NULL -> group by w.word; ERROR 1064: You have an error in your SQL syntax near 'LEFT JOIN events e2 on e.url_id = e2.url_id where e.word_id = w.word_id and ' at line 3 mysql> insert h2 -> select w.word,' ',0 -> from words w, events e, LEFT JOIN events e2 on e.url_id = e2.url_id -> where e.word_id = w.word_id -> and e.leftseq = 1 -> and e2.leftseq = 2 -> group by w.word; ERROR 1064: You have an error in your SQL syntax near 'LEFT JOIN events e2 on e.url_id = e2.url_id where e.word_id = w.word_id and ' at line 3 Appreciate your help in advance - thanks! --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php