Consulting

Results 1 to 2 of 2

Thread: Solved: SQL Syntax for querying two tables with specific columns

  1. #1
    VBAX Regular
    Joined
    Jan 2010
    Posts
    13
    Location

    Solved: SQL Syntax for querying two tables with specific columns

    Hello everybody

    This is probably a simple job but I could not figured out how can I do it and I will go crazy.

    Let's say you have two tables like this:

    orders

    orderno customerno orderdate orderquantity anotherfield
    ----------------------------------------------------------------
    1 12 12/03/2010 5 xxxx
    2 15 11/03/2010 20 yyyy
    customers

    customerno customername address city birth_date
    ----------------------------------------------------------------
    12 mike thompson any address some city 01/01/1995
    15 george brown some address lake city 05/05/1998

    both of the customers are under 18 but don't worry about it

    now, I would like to have this recordset in single query:

    orderno: 1
    customername: mike thompson
    orderdate: 12/03/2010
    orderquantity: 5

    in short terms, I need the query of orders table with customer name, instead of customer number. How can I query this?

  2. #2
    VBAX Regular
    Joined
    Jan 2010
    Posts
    13
    Location
    I have solved the problem with following query syntax:

    select orderno, orderdate, orderquantity, customerdate from orders, customers Where orders.customercode = customers.customercode and orderno = 1

Posting Permissions

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