Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
leracj
Starting Member
13 Posts |
Posted - 2013-06-23 : 22:28:50
|
having problems with the my sql codei want it to post only unique onesmy sql codeSELECT ID, user_login, user_email, meta_valueFROM wp_users um, wp_usermeta uWHERE user_id = IDAND meta_key = 'first_name'output:ID /user_login /user_email /meta_value1 ddwadmin info@ddwenterprises.com Dynamic2 pfitzgerald patricefitzgerald@gmail.com Patrice3 rleslie rk.leslie@gmail.com Richard88 richard leslie richard_leslie@yahoo.com Richard152 cedelen cheryledelen@gmail.com Cheryl152 cedelen cheryledelen@gmail.com Cheryl151 wgrossman wengros7@gmail.com Wendie151 wgrossman wengros7@gmail.com Wendie153 tyoney tazcdn@hotmail.com Theresa153 tyoney tazcdn@hotmail.com Theresa154 yyamaguchi yyamaguchi530@hotmail.com Yuki154 yyamaguchi yyamaguchi530@hotmail.com Yuki155 mlo mandylo@charter.net Mandy155 mlo mandylo@charter.net Mandy156 garmondino tralaala@optonline.net Gail156 garmondino tralaala@optonline.net Gail157 pjimenez polly@musiciansatplay.com Polly157 pjimenez polly@musiciansatplay.com Polly158 hheggie haheggie@gmail.com Hazel158 hheggie haheggie@gmail.com Hazel159 jduarte jwd@jwduarte.com Jennifer159 jduarte jwd@jwduarte.com Jennifersample tablewp_users:id /user_login /user_email2 /Patrice /tazcdn@hotmail.comwp_usermeta:user_id /meta_key /meta_value2 /first_name /Patrice2 /last_name /Fitzgerald2 /nickname /pfitzgeraldplease help |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-06-23 : 22:46:45
|
it will be easier for others to help you if you can post some sample data and your query over here. KH[spoiler]Time is always against us[/spoiler] |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-06-23 : 23:56:57
|
your query that joins the 2 tables produces 1 to many result.Is there a column user_id in the wp_usermeta table ?can you also post the structure for these 2 tables ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
leracj
Starting Member
13 Posts |
Posted - 2013-06-24 : 00:24:50
|
I just answered my own post SELECT DISTINCTplease help |
 |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-06-24 : 00:31:33
|
quote: Originally posted by leracj having problems with the my sql codei want it to post only unique onesmy sql codeSELECT ID, user_login, user_email, meta_valueFROM wp_users um, wp_usermeta uWHERE user_id = IDAND meta_key = 'first_name'
SELECT DISTINCT ID, user_login, user_email, meta_valueFROM wp_users um, wp_usermeta uWHERE user_id = IDAND meta_key = 'first_name'--Chandu |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-06-24 : 03:06:53
|
what is the primary key of the wp_usermeta ?looks like for every ID, you have 2 record in wp_usermeta with meta_key = 'first_name'Check your data KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|