how to join the output of multiple qeries in MS Access
i m writing a query to join the output of multiple queries in MS Access.
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
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 04:34 AM.
Reason: spelling correction
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'
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
By Darkrider in forum C++
Last Post: 04-24-2008, 07:03 AM
By Sumit in forum VB Classic
Last Post: 09-09-2006, 12:41 PM
By Darkrider in forum Database
Last Post: 11-28-2005, 01:56 PM
By David in forum VB Classic
Last Post: 04-10-2002, 03:22 PM
Last Post: 06-12-2001, 12:05 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL