Jump to content


Photo

Can't figure out how


  • Please log in to reply
2 replies to this topic

#1 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 28 November 2005 - 03:43 AM

Table1
fields:
JobNumber,
Dept,
LaborByJobNumber (For EACH Employee charging time to this job)

Table2
fields:
JobNumber,<--Multiple Listings
PartNumber,<--Each run of this PartNumber we build is done under a JobNumber for that PartNumber
Qty<-- The TOTAL units built by JobNumber

Need to end up with:

PartNumber, Dept, Total_Labor_By_Dept, Qty

I need to sum() the LaborByJobNumber grouped by Dept
AND
I need to sum() the QTY grouped by JobNumber

HELP!!!

#2 mofm

mofm
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 28 November 2005 - 04:27 AM

Union the statments together so your sql will look something like this

SELECT Name From Users
UNION
SELECT Name FROM Groups

emm u probly wont understand that so go here and it will explain [a href=\"http://www.mysqlfreaks.com/statements/13.php\" target=\"_blank\"]http://www.mysqlfreaks.com/statements/13.php[/a]

#3 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 28 November 2005 - 05:41 AM

Will mysql let you create an intermediary table as part of the query?

[!--quoteo(post=322638:date=Nov 27 2005, 11:27 PM:name=mofm)--][div class=\'quotetop\']QUOTE(mofm @ Nov 27 2005, 11:27 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Union the statments together so your sql will look something like this

SELECT Name From Users
UNION
SELECT Name FROM Groups

emm u probly wont understand that so go here and it will explain [a href=\"http://www.mysqlfreaks.com/statements/13.php\" target=\"_blank\"]http://www.mysqlfreaks.com/statements/13.php[/a]
[/quote]





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users