#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Help with SQL Select Query


    Hi to all,

    Hope somebody can help me. Right now I have a table where it has 5 columns (ie id,lessonname,status,content,username) now in the column username my program will dump a data that is like this (ie oipl,james). Now my question is what sql query can I do to get a result like this, lets say oipl only or james only. I have tried the like statement but it is just returning all the data.

    Note:
    please pm me for a sample screenshot for my table
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,024
    Rep Power
    4210
    Originally Posted by cervuxs
    Now my question is what sql query can I do to get a result like this, lets say oipl only or james only.
    Code:
    SELECT ...
      FROM ...
     WHERE username IN ('oipl','james')
    Originally Posted by cervuxs
    Note:
    please pm me for a sample screenshot for my table
    no
    r937.com | rudy.ca
    please visit Simply SQL and buy my book
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0
    Originally Posted by r937
    Code:
    SELECT ...
      FROM ...
     WHERE username IN ('oipl','james')
    no
    @r937 - it's not working. it just display me a blank result with no errors. and also the data I am saying is like this

    |id|chapter1|1|content|oipl,james|
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,024
    Rep Power
    4210
    you wanted "oipl only or james only"

    that's exactly what my query looks for
    r937.com | rudy.ca
    please visit Simply SQL and buy my book
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0
    Originally Posted by r937
    you wanted "oipl only or james only"

    that's exactly what my query looks for
    I've tried your query I am getting a blank result
  10. #6
  11. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,024
    Rep Power
    4210
    Originally Posted by cervuxs
    I've tried your query I am getting a blank result
    that means you don't have any rows with oipl only, and you don't have any rows with james only
    r937.com | rudy.ca
    please visit Simply SQL and buy my book

IMN logo majestic logo threadwatch logo seochat tools logo