Apr 9, 2008 #1 tekkerguy Programmer Nov 16, 2005 196 0 0 US is there anyway to do an order by in sql, but ignoring certain values? For example, order by "moneyinpocket" But if a value is null, "ND", or 0, ignore them.
is there anyway to do an order by in sql, but ignoring certain values? For example, order by "moneyinpocket" But if a value is null, "ND", or 0, ignore them.
Apr 9, 2008 #2 SantaMufasa Technical User Jul 17, 2003 12,588 0 0 US Tekker, How about: Code: ...order by nvl(moneyinpocket,0)... ...which says, "IF moneyinpocket IS NULL, THEN use '0' as the value of that tuple, otherwise use the value of moneyinpocket." Mufasa (aka Dave of Sandy, Utah, USA) [I provide low-cost, remote Database Administration services: www.dasages.com] Upvote 0 Downvote
Tekker, How about: Code: ...order by nvl(moneyinpocket,0)... ...which says, "IF moneyinpocket IS NULL, THEN use '0' as the value of that tuple, otherwise use the value of moneyinpocket." Mufasa (aka Dave of Sandy, Utah, USA) [I provide low-cost, remote Database Administration services: www.dasages.com]
Apr 10, 2008 #3 Turkbear Technical User Mar 22, 2002 8,631 0 0 US Hi, But that would not handle the examples: "ND" or 0 Would a Decode maybe work here? Order by decode(moneyinpocket,NULL,' ','ND',' ',0,' ',moneyinpocket) To Paraphrase:"The Help you get is proportional to the Help you give.." Upvote 0 Downvote
Hi, But that would not handle the examples: "ND" or 0 Would a Decode maybe work here? Order by decode(moneyinpocket,NULL,' ','ND',' ',0,' ',moneyinpocket) To Paraphrase:"The Help you get is proportional to the Help you give.."
Apr 10, 2008 #4 SantaMufasa Technical User Jul 17, 2003 12,588 0 0 US Good catch, Turk, I apparently read only what I wanted to read. . Yours is a better solution given the specifications. Mufasa (aka Dave of Sandy, Utah, USA) [I provide low-cost, remote Database Administration services: www.dasages.com] Upvote 0 Downvote
Good catch, Turk, I apparently read only what I wanted to read. . Yours is a better solution given the specifications. Mufasa (aka Dave of Sandy, Utah, USA) [I provide low-cost, remote Database Administration services: www.dasages.com]
Apr 13, 2008 #5 Turkbear Technical User Mar 22, 2002 8,631 0 0 US Hi, Its rare that you miss anything.... To Paraphrase:"The Help you get is proportional to the Help you give.." Upvote 0 Downvote
Hi, Its rare that you miss anything.... To Paraphrase:"The Help you get is proportional to the Help you give.."