browse by category or date

Let say you want to create a on-the-fly table which fetch the list of users with certain properties. The problem with the users is that, some of them is without any properties. Instead of displaying blank, you want to display ‘—-‘. Since you want to do this on the fly, not by modifying the table. These infos will come handy.

Simply using UNION will help you to achieve above problem. Meta-SQL :

Select User,Properties 
From Users where Properties <> Null 
Union 
Select User, '----' as Properties 
From users 
where User not in 
(Select User from Users where Properties <> Null)

In IIS, this will throw you Collation error if you Users table is encoded in UTF8, the Properties value of ‘—-‘ will be encoded in Latin. Thus, it will throws you collation error.

In order to convert the ‘—-‘ encoded as UTF8, you must use _utf8 as prefix of your string. Eq: _utf8′—-‘ instead of only ‘—-‘

GD Star Rating
loading...

Possibly relevant:

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Incoming Search

sql

No Comment

Add Your Comment