Getting mutliple values from mutliple tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahmee
    New Member
    • Mar 2010
    • 39

    #1

    Getting mutliple values from mutliple tables

    There are two table from which i want to get value
    1. heads
    2.subheads


    The field name in heads table is:

    id, head_name.


    the field name in subheads table is:
    id,subhead_name .



    i want to get value from these two table when the value mean id is '1'

    i wrote the query something like this
    Code:
    SELECT `head_name`,`subhead_name` FROM `heads`,`subheads` WHERE `head_name.id` = '1' AND `subhead_name` = '1
    '
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    So there's no question then?

    Comment

    • adriancs
      New Member
      • Apr 2011
      • 122

      #3
      Code:
      SELECT `head_name`,`subhead_name` FROM `heads`,`subheads` WHERE `heads`.`id` = 1 and `subheads`.`id` = 1;
      SELECT `head_name`,`subhead_name` FROM `heads`,`subheads` WHERE `heads`.`id` = `subheads`.`id` and `heads`.`id` = 1;

      Comment

      Working...