UNION ALL

The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type.

One of my work colleagues at work showed me something that I never knew about UNION SQL statement. By default the UNION statement does the exact same thing as a SELECT DISTINCT on the resulting data. But what if we want to carry out a UNION without distincting the data result? Thats where the UNION ALL comes into play.

Example

Table 1: tblCars-UK

Car_ID Car_Name
1 Volvo
2 Volkswagen
3 Chevrolet
4 Nissan
5 BMW

Table 2: tblCars-US

| Car_ID | Car**_Name** | | 1 | Pontiac | | 2 | Chrysler | | 3 | Chevrolet | | 4 | Dodge | | 5 | BMW |

If we used a UNION statement, the results would be as follows:

Select car_name from tblCars-UK
UNION
Select car_name from tbleCars-US 

| Car_Name | | Volvo | | Volkswagen | | Chevrolet | | Nissan | | BMW | | Pontiac | | Chrysler | | Dodge |

As you can see from the results above that the duplicate car entries have been removed and only displayed once. Now this is what will happen if we use UNION ALL statement:

Select car_name from tblCars-UK
UNION ALL
Select car_name from tbleCars-US

| Car_Name | | Volvo | | Volkswagen | | Chevrolet | | Nissan | | BMW | | Pontiac | | Chrysler | | Chevrolet | | Dodge | | BMW |

Fixing BlogEngine HTML Editor Problem

I have to say that after using BlogEngine for my first couple of posts, I can't think of any other Blogging tool to use. However, the thing that really annoys me about BlogEngine is the HTML editor when I want to create my postings. I have found that the TinyMCE HTML editor rejects some HTML tags. For example, <code> and <iframe> tags.

I have been desperately looking through the BlogEngine forum posting's to see if there is anyway to fix this problem. There was no specific way of rectifying this problem.

However, I found a way to fix this!!! Laughing

You will need to make a simple change to the tinyMCE.ascx file located in the admin folder (/wwwroot/admin/). Find the following line:

extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],script[charset|defer|language|src|type]",

Now you will see in this line that there are tag elements listed as valid. All you have to do is add tags to this line in order for them to be accepted by the TinyMCE HTML editor. For example, I want my <code> and <iframe> tags to be accepted:

extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],script[charset|defer|language|src|type],code,iframe",

And there you have it!

Hope this helps!