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

    Join Date
    May 2012
    Posts
    77
    Rep Power
    2

    Query multible tables get one result


    hello,

    I have a query I need some help with.

    Select * from users, mood where users.mood = mood.id

    This will return all rows where the criteria are meet.

    But instead of returning all rows I want to be able to do the same operation where the query is also limited by users.name

    adding & users.name = 'test' to the query did not work very well

    Does anyone know how to tacle this?
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,026
    Rep Power
    4210
    Originally Posted by odp
    adding & users.name = 'test' to the query did not work very well
    that's because "&" isn't valid sql

    try using AND instead

    r937.com | rudy.ca
    please visit Simply SQL and buy my book
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    77
    Rep Power
    2
    Originally Posted by r937
    that's because "&" isn't valid sql

    try using AND instead

    your a sweetheart
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,026
    Rep Power
    4210
    | you're*

    FTFY

    r937.com | rudy.ca
    please visit Simply SQL and buy my book

IMN logo majestic logo threadwatch logo seochat tools logo