Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 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 April 4th, 2008, 04:08 AM
Registered User
 
Join Date: Apr 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to Distinct two colums but select other colums

Hi all,

I have a table,

Station------Lat------Lon

Sta1_________10.1_____10.2
Sta__________10.1_____10.2
Sta2_________15.5_____15.5

I am trying to distinct the table with Lat and Lon values. And select ONE OF the Station values.

So final query result must be;

Station------Lat------Lon

Sta1_________10.1_____10.2
Sta2_________15.5_____15.5





Could you please help me?


 
Old April 4th, 2008, 07:53 AM
Authorized User
 
Join Date: Jun 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Preethi Send a message via Yahoo to Preethi
Default

Try this:
SELECT MIN(Station) Station, Lat, Lon
FROM <Table name>
GROUP BY Lat, Lon


G.R.Preethiviraj Kulasingham
 
Old April 5th, 2008, 06:08 AM
Registered User
 
Join Date: Apr 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot.






Similar Threads
Thread Thread Starter Forum Replies Last Post
onlick display more colums mateenmohd Classic ASP Basics 5 July 28th, 2007 07:12 AM
Displaying items in Colums in roes azambee Access 4 January 5th, 2007 04:57 AM
Dynamically adding Colums to datagrid ? vivekshah C# 0 April 15th, 2006 02:54 AM
group extra colums jun99 PHP How-To 0 December 5th, 2005 02:43 PM
Sorting on mulitple colums Greg Griffiths Javascript 0 June 20th, 2003 12:07 PM





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