SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    ireland
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can you have more than one id in a select

    How come the below select statement will work but when I add a second id to the select statement
    I keep getting an ambiguous error for that id.
    Is it not possible to select more than 2 id's in a select statement.

    Regards
    Graham


    ---------------------------------- Works -------------------------------

    SELECT
    id_grind,
    interest_name,
    subject_name,
    level_name,
    county_name,
    town_name,
    contact_name,
    contact_number,
    qualifications,
    experience,
    additional_locations,
    availability,
    rate_per_hour,
    additional_number,
    email_address,
    additional_information,
    username
    FROM
    grind_record,
    interests,
    subjects,
    levels,
    county,
    town,
    users,
    premium
    WHERE
    county.id_county = users.id_county
    AND
    town.id_town = users.id_town
    AND
    interests.id_interest = grind_record.id_interest
    AND
    subjects.id_subject = grind_record.id_subject
    AND
    levels.id_level = grind_record.id_level
    AND
    users.user_id = grind_record.user_id
    AND
    premium.id_premium = users.id_premium
    AND
    interests.id_interest = 2


    ---------------------------------- does not work Work -------------------------------

    SELECT
    id_grind,
    user_id,
    interest_name,
    subject_name,
    level_name,
    county_name,
    town_name,
    contact_name,
    contact_number,
    qualifications,
    experience,
    additional_locations,
    availability,
    rate_per_hour,
    additional_number,
    email_address,
    additional_information,
    username
    FROM
    grind_record,
    interests,
    subjects,
    levels,
    county,
    town,
    users,
    premium
    WHERE
    county.id_county = users.id_county
    AND
    town.id_town = users.id_town
    AND
    interests.id_interest = grind_record.id_interest
    AND
    subjects.id_subject = grind_record.id_subject
    AND
    levels.id_level = grind_record.id_level
    AND
    users.user_id = grind_record.user_id
    AND
    premium.id_premium = users.id_premium
    AND
    interests.id_interest = 2

  2. #2
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    700
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    e.g.

    Code:
     SELECT
    id_grind,
    users.user_id,

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    ireland
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice One it worked !


Bookmarks

Posting Permissions

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