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

    Join Date
    May 2012
    Posts
    77
    Rep Power
    3

    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,204
    Rep Power
    4279
    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

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    77
    Rep Power
    3
    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,204
    Rep Power
    4279
    | you're*

    FTFY

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo