Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.61 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. MySQL COALESCE alternative for selecting both result sets for an insert, not either / or?
  2. INSERT INTO notification
  3.        (text, type, target_id, sender_id, recipient_id, data, timestamp, is_unread)
  4. SELECT DISTINCT '$text', 'comment', '$id', '$senderId',
  5.        COALESCE(comment.author_id, stream.author_id),
  6.        '$dataArray','$timestamp', '1'
  7. FROM stream
  8.      LEFT JOIN comment ON comment.target_id = stream.id
  9. WHERE (comment.target_id = '$id' OR stream.id = '$id')
  10.   AND comment.author_id != '$senderId'"
  11.   AND stream.author_id != '$senderId'
  12.        
  13. select concat('a','b','c');
  14.        
  15. select concat_ws(',','a','b','c');