Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78

    Unanswered: listboxes and adding info from different queries

    Hello, does anyone know how I can display the results of two queries in one list box? I have a query that checks for seats available on flights 1. Gets the schedule information. 2. Checks the amount of seats booked on each flight, subtracts it from the total seat capacity for each flight to give seats left for sale on each flight. What I want to do is show the seats left for sale at the end of each line in a listbox against the flight schedule information. At the moment I create my SQL query and the assign it as the row scource for the listbox.

    Any ideas??
    the light is on, someone is home, but they dont know they are. HELLO!

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Create a subquery and assign it to the second column.

  3. #3
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78

    Red face

    Originally posted by Teddy
    Create a subquery and assign it to the second column.
    Thanks Teddy

    How do I do that?
    the light is on, someone is home, but they dont know they are. HELLO!

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    General syntax would be:

    SELECT table1.field1, (SELECT table2.field1 FROM table2 WHERE table2.foriegnkey = table1.key) AS field2
    FROM table1

    Here's a working example from one of my queries:

    SELECT company.company, (SELECT MIN(quote.eff_date) FROM quote WHERE quote.comp_num=company.comp_num)
    FROM company

    The above query returns a company name, and the earliest effective date associated with the company in the quote table, related by comp_num.

    the result looks like this (I took out the company names and replaced them with generic ones, but this is the actual output):

    company1 1997-07-16 00:00:00.000
    company2 1997-05-22 00:00:00.000
    company3 2000-08-25 00:00:00.000
    company4 2000-08-28 00:00:00.000

    AFter you have that defined the appropriate dataset, you can then set "columncount" to 2 for your listbox to display both columns on the same "line".

  5. #5
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78
    Thanks Teddy I'll give it a go.
    the light is on, someone is home, but they dont know they are. HELLO!

Posting Permissions

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