ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 11th, 2012, 10:09 AM
clawr687 clawr687 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 2 clawr687 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 27 sec
Reputation Power: 0
Joining issue

Hi everyone. I'm fairly new, mediocre at best and I have a joining problem. I currently have 2 queries right now.
rs_getrate:
SELECT *
FROM dbo.tbl_rate
JOIN dbo.tbl_site ON dbo.tbl_site.site_ID = dbo.tbl_rate.rate_site_IDref
JOIN dbo.tbl_rank ON dbo.tbl_rank.rank_ID = dbo.tbl_rate.rate_rank_IDref
WHERE dbo.tbl_rate.rate_site_IDref = #FORM.site_ID#

and rs_getlems:
SELECT *
FROM dbo.tbl_LEM, dbo.tbl_employee, dbo.tbl_site, dbo.tbl_rank
WHERE dbo.tbl_employee.employee_ID = dbo.tbl_LEM.employee_IDREF
AND dbo.tbl_LEM.site_IDREF = dbo.tbl_site.site_ID
AND dbo.tbl_rank.rank_ID = dbo.tbl_employee.employee_rankREF
AND dbo.tbl_LEM.LEM_date BETWEEN '#FORM.LEM_datefrom#' and '#FORM.LEM_dateto#'
AND dbo.tbl_site.site_ID = #FORM.site_ID#
AND dbo.tbl_LEM.LEM_posted = 'yes'
ORDER BY dbo.tbl_LEM.LEM_date ASC

I want to somehow join these 2 queries mentioned above.
Here are the column names for all the tables I need to pull out.

tbl_rate:
rate_ID, rate_site_IDref, rate_rank_IDref, rate_dollar, rate_ot, rate_dt, rate_loa

tbl_lem:
LEM_ID, LEM_date, employee_IDREF, LEM_reg_hrs, LEM_ot_hrs, LEM_dt_hrs, LEM_tt_hrs, site_IDREF, LEM_LOA, LEM_Expenseinfo,LEM_workorder, LEM_posted, LEM_Expense, LEM_reg_rate, Lem_ot_rate, LEM_dt_rate, Lem_tt_rate, Lem_loa_rate

tbl_rank:
rank_ID, rank_name,

tbl_employee:
employee_ID, employee_name, employee_number, employee_rankREF

tbl_site:
site_ID, site_Name, site_JobNumber

What I need to accomplish is: After navigating to a specific jobsite (#FORM.site_ID#) and specific date ( #FORM.LEM_date), the user chooses an employee from a drop down list and assigns hours (regular time, overtime, double time, etc) then the info gets posted to tbl_LEM. Which appears in an ongoing list on the same page. Each Iteration of rs_getLEMS needs to somehow have the rates from rs_getrates ( rate_dollar, rate_ot, rate_dt, rate_loa) in hidden input feilds ( LEM_reg_rate, Lem_ot_rate, LEM_dt_rate, Lem_tt_rate, Lem_loa_rate) so the user can "post" and update tbl_lems.

Hopefully this makes it all clear...

Reply With Quote
  #2  
Old February 11th, 2012, 03:49 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
If there a foreign key between tbl_LEM and tbl_rate?

Reply With Quote
  #3  
Old February 13th, 2012, 06:38 AM
clawr687 clawr687 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 2 clawr687 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 27 sec
Reputation Power: 0
No there is not.
tbl_rate is a link table for tbl_site and tbl_rank.

Reply With Quote
  #4  
Old February 13th, 2012, 08:46 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
If there's no way to join the tables I'm not sure what you actually want to do. How can you merge this all into one query if there is no way to relate the two tables?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Joining issue

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap