master82 Posted December 10, 2006 Share Posted December 10, 2006 I have these3 tables: Users, Job and JobPositionJob contains: (Dept.)jID (unique identifier)Job Position contains:(Job positions in dept)jpID (unique identifier)JID (linked to Job table to identify which positions belong in what dept.)RATEUsers table contains: (List of employees)UserID (unique identifier)jID (linked to Job table to establish users dept.)jpID (linked to Job Position table to establish the users job role)PROGRESSOk, what I want to do is a simple UPDATE query that will update PROGRESS in the users table by adding the current PROGRESS value to RATE found in the Job Position table (PROGRESS + RATE).What makes it too complicated for me is that i think you have to use JOIN etc in the query to correctly select the rate from the correct position and dept - confusing stuff!Anyone confiedent enought on using JOIN etc... in these queries that can help? Quote Link to comment Share on other sites More sharing options...
master82 Posted December 11, 2006 Author Share Posted December 11, 2006 bump...I think it goes something like[code]<?php"UPDATE users u LEFT JOIN jobposition us ON u.jpid=us.jpid SET us.userid=us.userid WHERE u.userid=$userid";?>[/code]Anyone able to do this kind of thing? Quote Link to comment Share on other sites More sharing options...
btherl Posted December 11, 2006 Share Posted December 11, 2006 What about this?[code=php:0]UPDATE users SET progress = progress + rate FROM jobposition WHERE jobposition.jpid = users.jpid[/code]I'm not 100% sure it will work, but it's worth a try :) Quote Link to comment Share on other sites More sharing options...
master82 Posted December 11, 2006 Author Share Posted December 11, 2006 Nice try but that didnt work ???Im pretty sure that the WHERE part needs to concern the userid Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.