Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 21st, 2005, 12:04 PM
sayzey sayzey is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Location: England
Posts: 17 sayzey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 42 m 29 sec
Reputation Power: 0
Cool An easy one for you all!

I'm confident that this is a really easy function that everyone except me knows!

Using SQL Server 2000 I have the following Query:

Code:
  SELECT DISTINCT Busno
  FROM         Route
  


Which returns all the buses in the table i.e.:

BusNo
34
89
234

etc

What i need is an number to be returned along with that value i.e:

Number BusNo
1 65
2 89
3 x56

This number doesnt actually mean anything, its just i need to output a temporary index number along with the busno, so I can populate a dropdown list.

As I said its bound to be something simple, so please let me know!

Cheers

Last edited by sayzey : March 21st, 2005 at 12:27 PM. Reason: typo

Reply With Quote
  #2  
Old March 21st, 2005, 12:27 PM
sayzey sayzey is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Location: England
Posts: 17 sayzey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 42 m 29 sec
Reputation Power: 0
Hey, managed to get a workaround so that i can get on with my application, however its not the tidiest way of doing it so if anyone has a "propper" way please do let me know.

Ive simply used the following and it works because there is only one instance of each result returned because SELECT DISTINCT is used.

Code:
 SELECT DISTINCT BusNo As BusIndex, BusNo
 FROM Route
 

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > An easy one for you all!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT