I have a table contain 3 fields (username,name,show_name). I want to select all records, but in case of show_name=false, 'name' field should be empty. I already write one with union, but i thought must be better way.
Show us what you already tried and we can point you in the right direction. Also what do you mean by show_name = false, is this stored as a string value? It would be best to also provide the table definition and some sample table entries.