Gossamer Forum
Home : General : Databases and SQL :

Format for DISTINCT, and grabbing ALL values..

Quote Reply
Format for DISTINCT, and grabbing ALL values..
Hi guys/gals,

I'm basically trying to do a DISTINCT select on a table.

The table contains;

ID | Username | SubmittedSiteFrom

Basically, I need to grab a list of UNIQUE usernames from this table. This works;

SELECT DISTINCT(Username) FROM lsql_
UserCreditTrack

However, this only gives access to "Username!", and not "SubmittedSiteFrom". Is there any way to specify that I want to import the SubmittedSiteFrom value too, into the hashref?

I've tried everything I can think of... but nothing will work :(

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Format for DISTINCT, and grabbing ALL values.. In reply to
What about this?

SELECT DISTINCT(Username),SubmittedSiteFrom FROM lsql_UserCreditTrack
Quote Reply
Re: [Gmail] Format for DISTINCT, and grabbing ALL values.. In reply to
Hi,

Thanks for the reply.. it works :) I'm not quite sure what was going on, but I'm 99% sure I already tried that format. I guess I didn't Unsure

Thanks again.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Gmail] Format for DISTINCT, and grabbing ALL values.. In reply to
Code:
SELECT DISTINCT Username ,SubmittedSiteFrom FROM lsql_UserCreditTrack

this would only display rows where all of the columns are distinct, not just username.