Click here to Skip to main content
15,074,987 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i used left join between to tables n my prob is when the left table doesn't find data in the right it shows NULL . I want that it wouldn't show any thing i mean the NULL word will not be there rather a blank cell. I mean it looks really ugly seeing the word NULL. Somebody please help.
Posted
Comments
Yogesh Pednekar 30-Aug-11 15:10pm
   
show me your query
Expected result
And result that you are getting.

Take a look at:
ISNULL (Transact-SQL)[^]

You can use this to convert the NULL to '' - an empty string. You may need to use CAST or CONVERT[^] if the column is not a string or char type.

Best regards
Espen Harlinn
   
SQL
select isnull([column name],'') from [TableName]
   
v3
Those values should be null (there is no value there). The UI control you use to display the result should do something sensible with it. You tagged the question C# – as far as I know the standard controls (DataGridView or DataGrid) already do that.

Don't worry about what it looks like in a database query result window, the purpose of that is not to look pretty.
   
Use INNER JOIN instead of LEFT JOIN

This article might help you in the future
Visual Representation of SQL Joins[^]
   
Comments
BobJanova 31-Aug-11 6:45am
   
An inner join will remove that row entirely. That's not what the question is asking for.
Simon Bang Terkildsen 31-Aug-11 9:11am
   
True, I seem to have missread the question. But no harm done, others have given an acceptable answer :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900