![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
select * from table1,table2 where table1.field1=table2.field1 and table1.field2=table2.field2 or (table1.field2 is null and table2.field2 is null) |
#3
| |||
| |||
|
|
is this the normal behaviour? is there any other way in which those rows where both fields are null are returned? |
#4
| |||
| |||
|
|
In article <4518fcd9$0$75040$14726298 (AT) news (DOT) sunsite.dk>, alex says... is this the normal behaviour? is there any other way in which those rows where both fields are null are returned? In all of the various programming languages I've used so far that have null, it is valid that (null != null) |
#5
| |||
| |||
|
|
PleegWat wrote: In article <4518fcd9$0$75040$14726298 (AT) news (DOT) sunsite.dk>, alex says... is this the normal behaviour? is there any other way in which those rows where both fields are null are returned? In all of the various programming languages I've used so far that have null, it is valid that (null != null) That's not exactly correct. In Java, for example, the comparison (null == null) equates to true. This applies to Progress also. I haven't tested any other languages, as these were the two that I have available. |
#6
| |||
| |||
|
|
En/na alex ha escrit: select * from table1,table2 where table1.field1=table2.field1 and table1.field2=table2.field2 or (table1.field2 is null and table2.field2 is null) ok, it seems this is a generic sql feature. so i'm going to use the "or" query. btw, the query was wrong as it needed a pair or parenthesis more: select * from table1,table2 where table1.field1=table2.field1 and (table1.field2=table2.field2 or (table1.field2 is null and table2.field2 is null)) |
#7
| |||
| |||
|
|
Murdoc wrote: PleegWat wrote: In article <4518fcd9$0$75040$14726298 (AT) news (DOT) sunsite.dk>, alex says... is this the normal behaviour? is there any other way in which those rows where both fields are null are returned? In all of the various programming languages I've used so far that have null, it is valid that (null != null) That's not exactly correct. In Java, for example, the comparison (null == null) equates to true. This applies to Progress also. I haven't tested any other languages, as these were the two that I have available. C/C++ it's also true, but that's because null is actually just a special value (usually 0, but not necessarily). However, SQL defines any comparison to NULL as false. |
![]() |
| Thread Tools | |
| Display Modes | |
| |