SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    SELECT two tables? Basic for Gurus

    Hi guys,

    I need little help.

    I have two tables.
    Table1: bsi_car_master
    Columns: car_id | car_vendor_id | car_model

    note: car_vendor_id column is the id of Table2

    Table2: bsi_car_vendor
    Columns: id | vendor_title

    I just want to combine vendor_title of Table2 and car_model of Table1
    How to properly SELECT this?

    Thank you very much in advance.
    I Love coding...
    Don't click this link.

  2. #2
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    This is what I tried so far,
    Code:
    $query = "SELECT bsi_car_vendor.vendor_title, bsi_car_master.car_model".
    		 "FROM bsi_car_vendor, bsi_car_master ".
    		 "WHERE bsi_car_vendor.id = bsi_car_master.car_vendor_id";
    I'm not sure if It is correct.
    Can someone inspect my work please.
    Thanks in advance.
    I Love coding...
    Don't click this link.

  3. #3
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Okay this select works,
    Code:
    $sql = "SELECT bsi_car_vendor.vendor_title, bsi_car_master.car_model FROM bsi_car_vendor, bsi_car_master WHERE bsi_car_vendor.id = bsi_car_master.car_vendor_id";
    My question, My answer lol
    Thanks to me.
    I Love coding...
    Don't click this link.


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
  •