General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 27th, 2002, 08:46 PM
qutaibah qutaibah is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 11 qutaibah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unique rows

Hi guys

Is there a way where I can SELECT * FROM TABLE where the value of the "entryRANK" field is unique?

would it be something like this:

"SELECT * FROM TABLE WHERE RANK is Unique"

thanks
Qutaibah

Reply With Quote
  #2  
Old July 28th, 2002, 04:09 AM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Hey,
You should use a distinct on the row that you want unique and also specify the other fields seperated by a comma, like this:

select distinct(myName), myAge, mySex, myBlah from myTable where 1

get the idea?

Reply With Quote
  #3  
Old July 28th, 2002, 02:57 PM
qutaibah qutaibah is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 11 qutaibah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
it worked = )

thanks mytch

I tried it and worked just fine
Qutaibah

Reply With Quote
  #4  
Old February 29th, 2004, 07:58 AM
Keymone Keymone is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 Keymone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy what's wromg?:(

mysql> select * from a;
+---+---+
| a | b |
+---+---+
| a | a |
| a | a |
| a | c |
| b | c |
| b | b |
+---+---+
5 rows in set (0.00 sec)


mysql> select distinct(a),b from a;
+---+---+
| a | b |
+---+---+
| a | a |
| a | c |
| b | c |
| b | b |
+---+---+
4 rows in set (0.00 sec)
WHYYY!!!!???? I WANT 2 ROWS!!! a IS DISTINCT!!! HEEEELP!

Reply With Quote
  #5  
Old February 29th, 2004, 08:05 AM
mjdundee mjdundee is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 mjdundee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb Try...


Table DATA
+---+---+
| a | b |
+---+---+
| 1 | a |
| 1 | a |
| 1 | c |
| 2 | c |
| 2 | b |
+---+---+

mysql> select * FROM DATA GROUP BY a;
+---+---+
| a | b |
+---+---+
| 1 | a |
| 2 | c |
+---+---+


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > Unique rows


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 3 hosted by Hostway