Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
samanthab
Starting Member
10 Posts |
Posted - 2009-02-10 : 09:48:09
|
| Hi i need help with this query that im trying to write..I need it to return all values that contain data within each table, and exclude/not list those that are empty... this is what ive got so far...SELECT var_ref_table.varname, node_ref_table.node, os_table.value, os_table.timestampFROM node_ref_table, var_ref_table, os_table WHERE node (is not null/empty) and varname (is not null/empty)Any ideas??Cheers |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-10 : 09:52:52
|
| [code]SELECT var_ref_table.varname, node_ref_table.node, os_table.value, os_table.timestampFROM node_ref_table, var_ref_table, os_table WHERE nullif(node,'') is not null and nullif(varname,'') is not null[/code] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-10 : 09:53:52
|
or evenSELECT var_ref_table.varname, node_ref_table.node, os_table.value, os_table.timestampFROM node_ref_table, var_ref_table, os_table WHERE node >'' and varname>'' |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-10 : 09:58:50
|
| Visakh, Will the NULLIF also work for decimal fields that have NULLS. I remember doing this sometime and encountered an data type error |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-10 : 10:01:47
|
quote: Originally posted by vijayisonly Visakh, Will the NULLIF also work for decimal fields that have NULLS. I remember doing this sometime and encountered an data type error
how will decimal fields contain blank value? |
 |
|
|
samanthab
Starting Member
10 Posts |
Posted - 2009-02-10 : 10:14:33
|
Thanks guys I used WHERE node >'' and varname>'' and it worked how i wanted!! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-10 : 10:18:44
|
welcome |
 |
|
|
|
|
|
|
|