Hi,
I think you could  use something like

SELECT DISTINCT 
(CASE p.ship_status 
WHEN '1' THEN "shipping_now" 
WHEN '2' THEN "shipping_soon" 
ELSE 'unknow'
END) as status
FROM products AS p
INNER JOIN  cart AS i
ON i.product_id = p.id
WHERE i.session_id = " & prepSQL(tConn, tSessionID);

If there are any products for the selected session_id this should return one 
row for every status like this

| status |
+-------------+
| unknown |
| shipping_now  |
| shipping_soon |


HTH
-- 
Dobromir Velev
[EMAIL PROTECTED]
http://www.websitepulse.com/

On Tuesday 25 October 2005 01:00, Scott Haneda wrote:
> tSql = "SELECT DISTINCT(p.ship_status)
>         FROM products AS p
>         INNER JOIN  cart AS i
>         ON i.product_id = p.id
>         WHERE i.session_id = " & prepSQL(tConn, tSessionID);
>
> p.ship_status is either a "1" or a "0", which is just how the database was
> set up ages, ago.  I am moving these to enum() types as I go, but to change
> this one, would break too much stuff.
>
> I would like to toss in a condition to the select so it returns
> "shipping_now" for "1" and "shipping_soon" for "2".  When I do this, I get
> zero results returned.
> --
> -------------------------------------------------------------
> Scott Haneda                                Tel: 415.898.2602
> <http://www.newgeo.com>                     Novato, CA U.S.A.


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

Reply via email to