Hi all
I have 2 tables. One called 'members' and the other called 'addresses'. Naturally there are members that are linked to addresses, it's quite simple.
I'm using a simple query to pull 2 fields from my members table which also should pull back around 6 fields from the addresses table. This works fine, but when there's not an address associated to a member, then obviously the query (below) returns NULLS.
Now, the problem is:- I'm using the SQL Function ISNULL to eliminate any NULL values, but it's just not working. What am I doing wrong?
The query:-
I have 2 tables. One called 'members' and the other called 'addresses'. Naturally there are members that are linked to addresses, it's quite simple.
I'm using a simple query to pull 2 fields from my members table which also should pull back around 6 fields from the addresses table. This works fine, but when there's not an address associated to a member, then obviously the query (below) returns NULLS.
Now, the problem is:- I'm using the SQL Function ISNULL to eliminate any NULL values, but it's just not working. What am I doing wrong?
The query:-
Code:
alter proc get_BizDetail
(
@strID varchar(32)
)
as
select biz_name,email,
(select ISNULL(line1,' ') from addresses a where a.member_uid=m.member_uid) line1,
(select ISNULL(line2,' ') from addresses a where a.member_uid=m.member_uid) line2,
(select ISNULL(town,' ') from addresses a where a.member_uid=m.member_uid) town,
(select ISNULL(county,' ') from addresses a where a.member_uid=m.member_uid) county,
(select ISNULL(postcode,' ') from addresses a where a.member_uid=m.member_uid) postcode
from members m where member_uid=@strID
go