query for Display data from two table

Discussion in 'PHP' started by nile1483, Apr 18, 2009.

  1. #1
    hi,

    first of of thanks for viwing my question, many times i get good answer from digitalpoint forum so i heartly thank full to all answerer

    my qestion is i want to knwo a query to display data from two different table where only one colu same in both table,i dont want to merge data of both table.

    let me explain

    i ahve two table lets say

    table_sales (sales_id, sales_title, property_type, sales_city)
    table_lettings (lettings_id, lettings_title, property_type, lettings_city)

    i want to data from both the table for property_type="commercial"

    like
    data from table_sales table where property_type = "commercial"
    data from table_lettings table where property_type = "commercial"

    also if you have idea tell me can i sort data from by title(sales_title, lettings_title)
     
    nile1483, Apr 18, 2009 IP
  2. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #2
    SELECT * FROM table_sales, table_lettings WHERE table_sales.property_type='commercial' AND table_lettings.property_type='commercial'
    Code (markup):
    Something like this :p
     
    ActiveFrost, Apr 18, 2009 IP