Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Unanswered: Query not returning all data

    Hello All,

    Extremely new at SQL, I'm in a class right now and I am not sure what I am doing wrong. I am supposed to write several statements using JOIN and BETWEEN, my statements look good and execute properly but for some reason not all the data is returning for example.

    Here is an example of the insert statement I am using

    HTML Code:
    INSERT INTO Employee VALUES
    ('Edelman', 'Glenn', '175 Bishop Lane', 'La Jolla', 'CA', '619', '555-1099', 'Cashier', '2003-10-07', 21500.00, 'M', 'Caucasian', 64);
    and here is the sample of one of the searches I'm trying to do.

    HTML Code:
    SELECT Employee.Last_name, Employee.First_name, Employee.Job_title, Job_title.EEO_1_Classification, Employee.Wage 
    FROM Employee JOIN job_title ON Employee.job_title = Job_title.Job_title WHERE Wage BETWEEN 15000.00 and 51000.00
    It should bring back about 12 hits but it is only bringing back 4 and I'm not sure why.

    Thank you for the guidance.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    probably because those other 8 don't have a matching row in the job_title table
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2011
    Posts
    2
    That was it! Thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •