Thank you, Johan and Chris, for finding my obvious mistakes. Unfortunately, 
even after fixing them, I still get an SQL error:

[EMAIL PROTECTED]:~$ cat OrderDB-requested.sql
SELECT 
   m.title AS "Main Category", 
   s.title AS "Sub Category", 
   b.partno AS "Part Number",
   (SELECT lv.title
      FROM langversion AS lv 
      JOIN baseitem AS b2 ON lv.baseitemid = b2.baseitemid
      WHERE lv.langid = "1" # English = 1
      AND b.baseitemid=lv.baseitemid
   ) as "English Title",
   IF((IFNULL(SELECT lv.langversionid 
                      FROM langversion AS lv
                      JOIN baseitem AS b3 ON lv.baseitemid = b3.baseitemid
                      WHERE lv.langid = "1" 
                      AND b.baseitemid = lv.baseitemid
   ), 0), 'Y', 'N') AS "Lang Avail"
FROM maincategory AS m 
JOIN subcategory AS s ON m.maincatid=s.maincatid 
JOIN baseitem AS b ON s.subcatid=b.subcatid 
WHERE 
   b.available = "Y" 
ORDER BY m.title, s.title;
[EMAIL PROTECTED]:~$ mysql orderDB <OrderDB-requested.sql
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the 
manual that corresponds to your MySQL server version for the right syntax to 
use near 'SELECT lv.langversionid 
                      FROM langversion AS lv
                      JO' at line 11
[EMAIL PROTECTED]:~$

-Kevin

-----Original Message-----
From: Chris Sansom [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 26, 2006 12:45 PM
To: Zembower, Kevin; mysql@lists.mysql.com
Subject: Re: Requesting help with subquery

At 11:40 -0400 26/9/06, Zembower, Kevin wrote:
>    IF(ISNULL(SELECT lv.langversionid
>                       FROM langversion AS lv
>                       JOIN baseitem AS b3 ON lv.baseitemid =
>b3.baseitemid
>                       WHERE lv.langid = "1"
>                       AND b.baseitemid = lv.baseitemid
>      )), 'Y', 'N') AS "Lang Avail"

Looks to me as if your parentheses don't balance 
here - you have an extra ')' in that last line.

-- 
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

I once preached peaceful coexistence with Windows.
You may laugh at my expense - I deserve it.
    -- Jean-Louis Gassé, former Apple executive (& Be CEO)

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

Reply via email to