|
-
Oct 9th, 2002, 10:06 PM
#1
Thread Starter
Stuck in the 80s
MySQL Unique Question
I need a refresher here. Let's say I want to select from a database where the user='blah' and subscribe='1' but there will be multiple entries for that user. This is for the boards I'm working on, if you need a better picture of what I'm doing.
So can I do:
Code:
SELECT UNIQUE user, subscribe WHERE user='blah' AND subscribe='1'
Or:
Code:
SELECT UNIQUE user WHERE user='blah' AND subscribe='1'
Or...?
-
Oct 10th, 2002, 02:18 PM
#2
Thread Starter
Stuck in the 80s
oh, it's DISTINCT, isn't it?
-
Oct 11th, 2002, 05:59 PM
#3
Frenzied Member
why use distinct if you have the where clause looking for a specific user?
and you let users have the same user name as everybody else?
distinct looks for words that have multiple copies of itself and gets just one.
-
Oct 11th, 2002, 06:25 PM
#4
Thread Starter
Stuck in the 80s
because there can be more than one entry (more than one post) in table for that user with the same parent.
I figured it out. Works perfectly with distinct. Without it, it would return:
The Hobo
The Hobo
The Hobo
and I would get three subscription e-mails. Distinct limits that to one unique username in the result.
-
Oct 15th, 2002, 02:13 PM
#5
Frenzied Member
ahh sorry that makes since. helps to know what you were trying to do and how many results you were trying to get. I assumed (shame on me) that you only wanted one result.
-
Oct 15th, 2002, 03:08 PM
#6
Thread Starter
Stuck in the 80s
Originally posted by phpman
ahh sorry that makes since. helps to know what you were trying to do and how many results you were trying to get. I assumed (shame on me) that you only wanted one result.
Sorry about that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|