Ansel_Tk1 Posted July 21, 2008 Share Posted July 21, 2008 Hi - can someone point me in the right direction? My SQL statement: SELECT DISTINCT onlinetotal.FamilyID FROM onlinetotal JOIN login ON onlinetotal.FamilyID = login.family_id WHERE recupdated = 1 ORDER BY onlinetotal.FamilyID I get 1 record as expected, but I don't get any of the values in the fields of the table login. There is a field in the login table that I specifically want: login.email_usr Basically, For each unique family_id value, I want the corresponding email_user value in the login table, using family_id as the key. Thanks for any help. Dan Quote Link to comment Share on other sites More sharing options...
Zwiter Posted July 21, 2008 Share Posted July 21, 2008 You have to write the attribute list you want to get in the select. Leave the dinstinct in front of the attribute you want unique. But i suggest to use a group by. Z. Quote Link to comment Share on other sites More sharing options...
Ansel_Tk1 Posted July 21, 2008 Author Share Posted July 21, 2008 Thanks Zwiter! Appreciate your help! Quote Link to comment Share on other sites More sharing options...
tivrfoa Posted July 21, 2008 Share Posted July 21, 2008 Just to correct the use of distinct. Distinct is used when you don't want to show equals rows, so you have unique rows, it's not used for attributes, and you must use distinct soon after the select. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.