Jump to content


- - - - -

Subquery with left join


  • Please log in to reply
No replies to this topic

#1 Sandi

Sandi

    Coder

  • IM Supporters
  • PipPipPipPipPipPipPip
  • 812 posts
  • Location:Janesville, Wisconsin
  • Real Name:Sandra
  • IPB Version:v3.2.x
Contributor

Posted 18 July 2010 - 05:01 AM

I'm having trouble building an update with a subquery and a left join. My forum has some non-human bots and I wat to set their photo the same as their avatar. The WHERE comparison uses the mysql % wildcard to mask the image name in the path.

1	UPDATE ibf_profile_portal
2		SET pp_main_photo = avatar_location
3		WHERE avatar_location =
4		(
5		SELECT p.pp_main_photo, me.avatar_location
6		FROM ibf_profile_portal as p
7		LEFT JOIN ibf_member_extra as me on (p.pp_main_photo = me.avatar_location)
8		WHERE me.avatar_location LIKE ('bots/mafia_bots/avatars/%');
9		);

Error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 8

Posted Image





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users