Kris,

Is

   ...LIKE '%[img]' + i.image_name + '[/img]%'

what you're looking for?

PB

  ----- Original Message -----
  From: Kris Burford
  To: [EMAIL PROTECTED]
  Sent: Friday, March 12, 2004 7:03 AM
  Subject: query reference help


  hi

  i'm having problems trying to write a query that returns a list of images
  and the stories (if any) that they're associated with. in this case, the
  story references the image embedded into the story body text in the format
  [img]myimage.jpg[/img]

  SELECT i.id, i.image_name, i.image_width, i.image_height, s.id as
story_id,
  s.title
  FROM images i
  LEFT JOIN stories s
  ON s.body like '[img]' + i.image_name + '[/img]'
  WHERE i.image_name like '%$search%'
  ORDER by i.image_name

  this returns the appropriate images, but doesn't pick up any associated
  stories (which i *know* exist).

  i'm guessing that it's something to do with the ON clause, but i don't
  understand what's wrong.

  many thanks

  kris
  --
  kris burford
  midtempo ltd
  http://www.midtempo.net


  --
  MySQL General Mailing List
  For list archives: http://lists.mysql.com/mysql
  To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


Reply via email to