Wrox Programmer Forums
|
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 November 4th, 2005, 01:13 AM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sorting problem

Hi All,

i would like ask if i want to sort the table by DateModified, but it onlycompare for the day, not for the whole string(02/11/05), what i should add into my code to fix this problem?
It is because i want to list the table where the latest record on the top.
Please someone help me about this!!!!!!
Thanks!!

 
Old November 4th, 2005, 02:42 AM
Wrox Author
 
Join Date: May 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is this what you want to do?

select name, productnumber, ModifiedDate from Production.Product
order by Day(ModifiedDate)

This sorts only by the day number regardless of the year and month. You could also add:

order by Month(ModifiedDate), Day(ModifiedDate)

Paul Turley, MCSD, MCDBA, MCT, MSF Practitioner
 
Old November 7th, 2005, 03:36 PM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you may want to do datediff where < 1?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Collapsible table sorting problem sendkamal Javascript 0 February 27th, 2007 12:33 PM
Sorting problem (Paging) pat123 XSLT 9 January 30th, 2007 01:00 PM
Large Text Sorting Problem shellhb ASP.NET 1.0 and 1.1 Basics 0 October 27th, 2005 02:46 PM
Sorting Problem whiterainbow BOOK: Access 2003 VBA Programmer's Reference 4 June 6th, 2005 12:59 AM
Difficult sorting problem sunjammer XSLT 0 July 1st, 2003 11:34 PM





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