how to join the output of multiple qeries in MS Access


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: how to join the output of multiple qeries in MS Access

  1. #1
    Join Date
    Feb 2007
    Posts
    13

    Question how to join the output of multiple qeries in MS Access

    hi,

    i m writing a query to join the output of multiple queries in MS Access.

    for example:

    i have 3 tables Audio,Video,Broadcast
    i have written 3 queries to extract the count of records in the above 3 tables depending upon a condition.

    select count(ID) from Audio where somecolunm="something";
    select count(ID) from Video where somecolunm="something";
    select count(ID) from Broadcast where somecolunm="something";

    These queries will give a a single value as output.

    i want to insert corresponding values in a table which has a the following fields

    weeknumber,audio,video,broadcast

    how do i prepare a query to do this?

    this is the first time i m writing SQL statements...so please help me out..
    Last edited by riz.pro; 04-29-2007 at 03:34 AM. Reason: spelling correction

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Assuming your output table is named "output," try this:

    INSERT INTO [output] (audio, video, broadcast)
    SELECT COUNT (audio.id) AS audio,
    COUNT(video.id) AS video,
    COUNT(broadcast.id) AS broadcast
    FROM (audio INNER JOIN video ON audio.somecolumn = video.somecolumn)
    INNER JOIN broadcast ON video.somecolumn = broadcast.somecolumn
    WHERE audio.somecolumn = 'something'
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Replies: 1
    Last Post: 04-24-2008, 06:03 AM
  2. Multiple Access
    By Sumit in forum VB Classic
    Replies: 0
    Last Post: 09-09-2006, 11:41 AM
  3. Replies: 0
    Last Post: 11-28-2005, 12:56 PM
  4. Replies: 13
    Last Post: 04-10-2002, 02:22 PM
  5. Replies: 3
    Last Post: 06-12-2001, 11:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center