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 2005 Forums
 Transact-SQL (2005)
 Query to eliminate the records

Author  Topic 

kamal.A
Yak Posting Veteran

70 Posts

Posted - 2008-04-07 : 13:59:42
Hai

I have written one select statement and it returns the following records.

SELECT a.Name, b.address FROM tbl1 a INNER JOIN tbl2 b ON a.id=b.id

Name address
AAA XYZ
BBB
CCC
DDD

My requirement is to display only if address fields contain values.
For Eg. I want to display AAA XYZ record only. How can I write a query.

Help me.

Kamal..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-07 : 14:22:35
SELECT a.Name, b.address
FROM tbl1 a
INNER JOIN tbl2 b ON a.id=b.id
WHERE ISNULL(b.address,'') <> ''
Go to Top of Page

kamal.A
Yak Posting Veteran

70 Posts

Posted - 2008-04-07 : 14:37:03
Thanks a lot.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-08 : 06:09:55
or

SELECT a.Name, b.address
FROM tbl1 a
INNER JOIN tbl2 b ON a.id=b.id
WHERE b.address>''

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -