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 |
|
pras2007
Posting Yak Master
216 Posts |
Posted - 2009-12-15 : 23:40:16
|
| Hello All,I want to be able to filter out records that has 0 for the sys_insert field without specifying it in the where clause, how can this be done?If I multiple the values for the ID field to the sys_insert field I get values where the sys_insert field is 1. The problem with this method is that 0 values are showing, how can I 0 values be filter out in the result set?Sample table: ID Sys_Insert100 0100 1100 0100 1200 1200 1300 0300 0500 1select distinct (id * sys_insert) AS LDS from testshould be:LDS100200500Instead of:LDS0100200500 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-12-16 : 01:59:54
|
| Why do you not want to specify it in the where clause?MadhivananFailing to plan is Planning to fail |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-12-16 : 18:15:54
|
| you could do something silly likeSELECT id * sys_insertfrom yourTablegroup by id * sys_inserthaving id * sys_insert > 0but where sys_insert > 0 makes a lot more senseJimEveryday I learn something that somebody else already knew |
 |
|
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2009-12-17 : 11:24:30
|
| select id * sys_insert AS LDS from testexceptselect 0 |
 |
|
|
|
|
|