MySQL subquery within LIKE CONCAT -


i'm trying create query checks inserted value against field. i'm trying accomplish using sub-query, got stuck. i'm trying accomplish:

(message1) user1 says: hello user2 (message2) chatx says: user1, user2 said hello you!  

i figured in order accomplish that, need subquery within statement.

select chat.id, chat.userid, chat.message, user.userid, user.username  chat, user  lower(message) concat('hello ', (select user.username user xxx = user.username))    , chat.userid = user.userid 

the xxx in statement, username said hello to. it's there should check against user table , if message matches user output chatx's line. question, how make xxx work , how set it?

select c.id, c.message,        sender.userid, sender.username,        receiver.userid, receiver.username chat c join user sender on c.userid = sender.userid join user receiver on lower(message) concat('hello ', receiver.username) 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -