Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

order by int avoiding null values

Posted on 2010-08-25
4
Medium Priority
?
315 Views
Last Modified: 2013-12-13
Hi

i am ordering my query by seq and seq is integer ..
my problem is that the order starts with null values how i can avoid null values to be in the first
the order must start with values asc and the null values will be all in the last as they have no values
Regards
A.S
0
Comment
Question by:asaidi
  • 2
4 Comments
 
LVL 11

Expert Comment

by:Rajesh Dalmia
ID: 33521910
it will be like

select * from table where column1 is not null order by column1 asc
0
 

Author Comment

by:asaidi
ID: 33521989
Hi rdonline1

thanks but i want to display all the data not only the not null..
0
 
LVL 11

Accepted Solution

by:
Rajesh Dalmia earned 1000 total points
ID: 33522016
0
 
LVL 44

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 1000 total points
ID: 33522018
Hi asaidi,

Couple of ways you can do this.



//Method 1
SELECT seq FROM ordersTable ORDER BY ISNULL(seq), seq ASC;

//Method 2
SELECT seq FROM ordersTable ORDER BY -seq DESC;

Open in new window

0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question