Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2005, 09:33 PM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to eliminate all the extra zero?

I have a problem with this view....

OrdQty DespQty Value Total Profit OrdNo
100.0 0.0 4.173 417.329 100.0 044454
1.0 0.0 12.0 12.0 0.0 044454
1.0 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454

In here, how i can eliminate all the zero and null field which is not necessary to display out? i want to do it automatically, because in this DB it will always have new entry.
How to write the sql statement for this kind of problem?
Thanks!

 
Old June 28th, 2005, 09:44 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Are you tried filtering your results using a WHERE clause? For example:
SELECT OrdQty, DespQty, Value, Total, Profit, OrdNo
FROM table
WHERE OrdQty IS NOT NULL
AND OrdQty <> 0.0

What does your current SELECT statment look like? What do you want your end results to look like?

Scott

 
Old June 29th, 2005, 09:37 PM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No..my SELECT statement is just like
SELECT OrdQty, DeapQty, Value, Total, Profit, OrdNo
FROM view
WHERE OrdNo is < '99999'
But when i try to output the result to the FrontPage, it will display all the extra 0 in the NULL field(which is i dont want)

OrdQty DespQty Value Total Profit OrdNo
100.0 0.0 4.173 417.329 100.0 044454
1.0 0.0 12.0 12.0 0.0 044454
1.0 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
So my question is how to get rid the extra zero by using the SELECT statment or IF statement?

 
Old June 29th, 2005, 09:47 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

The easiest way is to use the SELECT statment and filter the results further in the WHERE clause as I showed earlier.

WHERE OrdNo is < '99999'
AND OrdQty IS NOT NULL

This will return only the records that do not have a ) in the NULL field.






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to hide or eliminate console window mohammed imam ahamed Java Basics 0 November 1st, 2008 11:05 PM
How to eliminate special characters from string dadahonde VB How-To 2 March 11th, 2005 05:14 AM
eliminate duplicates where attribute names differ dasdrs XSLT 2 August 9th, 2004 09:29 AM
eliminate duplicates in selected columns Callie SQL Server 2000 3 April 29th, 2004 10:57 PM
Eliminate duplicate entries - sql query nlicata SQL Server 2000 2 September 17th, 2003 10:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.