Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SELECT CASE problem

Author  Topic 

doristan
Starting Member

12 Posts

Posted - 2006-08-29 : 07:42:22
Hi;
I have a query which does not ooutput the result that i wanted, please take a look at my query:

SELECT user_10= CASE
WHEN S.ship_to_ADDR_NO IS NULL THEN ''
ELSE u.USER_10
END,
r.total_amount
FROM receivable r, SHIPPER S, CUST_ADDRESS CA,
(SELECT ca.user_10
FROM cust_address ca, receivable R, SHIPPER S
WHERE R.INVOICE_id= '06/22990'
AND R.INVOICE_ID = S.INVOICE_ID
AND ca.customer_id= R.customer_id
AND ca.addr_no= CAST(S.SHIP_TO_ADDR_NO AS SMALLINT))u
WHERE R.invoice_id= '06/22990'
AND S.packlist_id = '181790'


This query will list the result only if there is SHIP_TO_ADDR_NO, But anyhow, if there is no SHIP_TO_ADDR_NO (which is = NULL) this result display nothing, which is not what i want, i want it to display out '' even there is no SHIP_TO_ADDR_NO, can anyone help me here?
Thanks and regards;
Doris

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-08-29 : 07:53:39
dupe of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=71200


-ec
Go to Top of Page
   

- Advertisement -