PDA

View Full Version : query question


hobbybox
08-20-2008, 09:16 PM
In the past I asked about how to get a list of members that have a certain item in their custom profile field.

I was given this code

SELECT userid, field14
FROM userfield
WHERE field13 = '1'

It works great - it lists the user number and the info in the field....

My questions is this - what do I need to change so it list the user id AND the username with the userfield?

hobbybox
08-22-2008, 02:24 AM
Anyone?

Eikinskjaldi
08-22-2008, 02:36 AM
In the past I asked about how to get a list of members that have a certain item in their custom profile field.

I was given this code

SELECT userid, field14
FROM userfield
WHERE field13 = '1'

It works great - it lists the user number and the info in the field....

My questions is this - what do I need to change so it list the user id AND the username with the userfield?

select u.userid, username, field14
from user u
join userfield
using (userid)
where field13='1'

hobbybox
08-22-2008, 03:03 AM
Works like a charm - Thanks a million!