Unique data query

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
ptysell
Forum Commoner
Posts: 34
Joined: Tue Dec 02, 2003 9:27 pm
Location: USC

Unique data query

Post by ptysell »

I have a database that looks something like this

M1 About
M1 Help
M1 LALALA
M2 ZZZ
M2 ZZZdgfdfsg
M3 alksdjfklasdj
M4 alsdkfjasjld
M4 asjfjlaskdf
ect...

I want a query that will just return

M1, M2, M3, M4, ect...

Thanks, i just am looking for something simple.
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

I'm guessing the table structure:

Code: Select all

the_m |  inside_the_m
M1 | About
M1 | Help
M1 | LALALA
M2 | ZZZ
M2 | ZZZdgfdfsg
M3 | alksdjfklasdj
M4 | alsdkfjasjld
M4 | asjfjlaskdf
You can do a query as:

Code: Select all

SELECT DISTINCT the_m FROM the_table
-Nay
ptysell
Forum Commoner
Posts: 34
Joined: Tue Dec 02, 2003 9:27 pm
Location: USC

Post by ptysell »

thanks

for some reason i was suck on the thought that it was

SELECT UNIQUE id FROM subsection

or something involving UNIQUE

Thanks
Post Reply