Results 1 to 4 of 4

Thread: Can I use sql to get data from different tables?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2001
    Posts
    42

    Question Can I use sql to get data from different tables?

    I currently have:

    sql="select data from tablename"

    But I need to go to another table and get records with data.

    Can this be done or do I need 2 different sql statements??

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    SELECT Table1.Price, Table2.Location FROM Table1, Table2

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    It's called "Joining Tables". There's ton's of information out there on this subject.

  4. #4
    jim mcnamara
    Guest
    You can also create a view (a query, depending on the db you're using).

    ansi sql view creation:
    Create View MyView as select one, two,three from tableA, tableB
    where tableA.four = tableB.four;

    You then just say:

    Select * from MyView;

Posting Permissions

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



Click Here to Expand Forum to Full Width