Reply
Help Using a Join and SUM
Old 12-15-2007, 07:47 AM Help Using a Join and SUM
ChipJohns's Avatar
I don't know! Do you?

Posts: 477
Name: Chip Johns
Location: Savannah Georgia
I am trying to expand past my current limited abilities with this and Man! am I getting a heading..!

Here is what I am using..

I can get it to work without the smeLastName. But, not with..

What am I missing?

PHP Code:
strQ "SELECT SUM(trTime) AS TtlTime"
strQ strQ " FROM smeTracking a "
strQ strQ " INNER JOIN sme b  "
strQ strQ " ON a.smeID = b.smeID "
strQ strQ " WHERE a.ppID = "
strQ strQ &  strppID
strQ 
strQ &  " GROUP BY a.smeID "
objRS.Open strQ
 
 
<% While Not ObjRS.EOF %>
 
Response.Write  objRS("smeLastName") %> - <% Response.Write  objRS("TtlTime") %> <br /> 
 
 
<%
objRS.MoveNext
Wend
objRS
.Close
objConn
.Close
%> 
Thanks for any direction

~Chip
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
When You Register, These Ads Go Away!
     
Old 12-15-2007, 06:34 PM Re: Help Using a Join and SUM
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
I'm not sure how you're approaching this? When you try to get the last name, are you adding that to your select and group by clause?
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 12-18-2007, 01:01 AM Re: Help Using a Join and SUM
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
It's not working because smeLastName isn't a SELECTed field in your query. It would look something like:

strQ = "SELECT smeLastName, SUM(trTime) AS TtlTime" ...
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 12-20-2007, 09:52 AM Re: Help Using a Join and SUM
ChipJohns's Avatar
I don't know! Do you?

Posts: 477
Name: Chip Johns
Location: Savannah Georgia
Thanks Forrest and Adam.

I see, (I think.) I'll give this a try and get back with results +
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 12-20-2007, 10:54 AM Re: Help Using a Join and SUM
ChipJohns's Avatar
I don't know! Do you?

Posts: 477
Name: Chip Johns
Location: Savannah Georgia
ok. I see what problem I'm not able to overcome. I see what you are saying Adam. I need to request the info if I want to show it.

The smeLastName is not in the smeTracking Table. It is in the sme table.

TABLE ONE: [sme] I have a table that lists sme's (Subject Matter Experts.)
This table has sme name and ID number for each sme (smeID which is generated as a primary key.)

TABLE TWO: Then I have a talbe that records the time on any given project they work on. This table uses the smeID number from the sme table then a field for hours worked, and another field for the date, and finally a field with a project number in it.


What I want to do is output a list that shows how much total time each sme has for the project...

I am learning a lot from this project, so I really do appreciate the help!
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 12-26-2007, 03:02 AM Re: Help Using a Join and SUM
Novice Talker

Posts: 10
Name: Cookie
kewl. i actually hav no idea wat u guys r talking about. other than some kind of programming... tried that myself once and failed miserably

but anyways... COOL
brookittykat12 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help Using a Join and SUM
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13563 seconds with 13 queries