Results 1 to 2 of 2

Thread: sql query help

  1. #1
    Join Date
    Sep 2003
    Posts
    6

    Unanswered: sql query help

    Dear friends ,
    i have a problem with the group by clause of the SQL query.
    i have two tables
    1. Vehicle
    vehicleownerID
    make_ID
    year
    2.Make
    make_Id
    make_Name
    now to find the record count of all the vehicle_ID with make_Name =Chevrolet
    which of the either two should be the query....
    SELECT veh.vehicle_Id, veh.year
    FROM veh INNER JOIN MakeF ON veh.make_Id = MakeF.Make_Id
    WHERE (((MakeF.Make_Name)="CHEVROLET"))
    GROUP BY veh.vehicle_Id, veh.year;

    OR>>>>>>>>>>>>>>>
    SELECT veh.vehicle_Id, veh.year
    FROM veh INNER JOIN MakeF ON veh.make_Id = MakeF.Make_Id
    WHERE (((MakeF.Make_Name)="CHEVROLET"));
    plz help me out.
    whether i need the group by clause or not...
    plz email at monarips@yahoo.ca
    Thanks a ton in advance
    U'rs
    mona

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    neither one of those queries will give you the count

    select count(*)
    from veh
    inner
    join MakeF
    on veh.make_Id = MakeF.Make_Id
    where MakeF.Make_Name = 'CHEVROLET'


    rudy
    http://r937.com/

Posting Permissions

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