SQL allows joining on any columns and any conditions.
However, you should not allow joining on floating point columns, if you can prevent using equality conditions on such columns. The simple replacement is to allow joins on decimal/numeric columns.
What is the problem? WYSIWIG (what-you-see-is-what-you-get) is the problem. Two floating point values can look the same, and yet be different. This causes join
s to fail.
You can specify the conditions as essentially:
on abs(a - b) < 0.00001 -- your favorite threshold
but this prevents the use of an index. Some databases may have "fuzzy" match for floating point numbers.
There are cases where you might want inequality joins using floating point values. This would be when doing ranges:
limit val
1.4142 'a'
2.7182 'b'
3.1415 'c'
But this is a rare condition -- particularly when the limits should be floating point rather than counts or monetary limits.