Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 25th, 2004, 11:00 PM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Join Query

Hello mates,

  I have two tables. operationdetails and dailyoperations
Structure:
operationdetails:
-----------------
indexno (PK) job_code operation_no description

dailyoperations:
-----------------
dindex empid job_code operation_no qtyfinishes

I need a report to get

job_code(from table1) operation_no(from tab1) finishedqty(tab2)

Ex:
04A001 10 200
04A002 15 150
04A003 17 0 (means no records in tab2 for that operation)
.
.
.

The first table qry is like this
select job_code,operation_no from operationdetails where description='QUALITY CHECKING'

I need to get sum(qty) from second table whose job_code and operation_no matches.

Can u suggest the query?




 
Old November 26th, 2004, 04:26 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

What you can get away with will depend on your database, but the following works with MySQL
Code:
SELECT od.job_code, od.operation_no, COUNT(do.dindex) 
FROM operationdetails od LEFT JOIN dailyoperations do 
ON od.job_code = do.job_code AND od.operation_no = do.operation_no 
GROUP BY od.job_code, od.operation_no;
HTH,

Chris

 
Old December 2nd, 2004, 09:31 AM
Authorized User
 
Join Date: Dec 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can i select 2 or more tables without join it? and is there any disadvantages or the advantages...without make the tables joined.may u give me diexamples query, without join mode. thx
cheers






Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help using join in SQL query yogeshyl SQL Language 1 July 30th, 2008 04:12 AM
Nested Query or Join? rlull SQL Server 2000 4 November 10th, 2005 05:23 PM
Opposite to INNER JOIN query crisan Access 1 April 29th, 2005 06:50 AM
JOIN query wverner Access 2 April 5th, 2005 01:44 PM
Strange join query nikosdra SQL Language 1 August 10th, 2003 06:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.