Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
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!
 
 
Register now for full access!
Old 12-15-2007, 07:34 PM Re: Help Using a Join and SUM
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
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?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 12-18-2007, 02:01 AM Re: Help Using a Join and SUM
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
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" ...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 12-20-2007, 10:52 AM Re: Help Using a Join and SUM
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
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, 11:54 AM Re: Help Using a Join and SUM
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
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, 04:02 AM Re: Help Using a Join and SUM
Novice Talker

Posts: 10
Name: Cookie
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.23006 seconds with 12 queries