iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-03-2004, 01:38 PM
WebProWorld New Member
 
Join Date: Apr 2004
Location: Mpls
Posts: 4
Gresser RepRank 0
Default DB Query Help. trying to find missing entries

Hi all,

Basically there are 2 tables, one that holds:
Time: JobID, PhaseID, Hours, Date.
The other has:
Cost: JobID, PhaseID, Cost

What I want to do is check to see if there are any JobID / PhaseID pairs in Time that are not in Cost. If such an entry exist, I would like to insert an entry with (JobID, PhaseID, 0) so my update statement will match and insert the new data.

Thanks for any help!
Reply With Quote
  #2 (permalink)  
Old 05-06-2004, 01:43 AM
WebProWorld Veteran
 
Join Date: Apr 2004
Posts: 447
HardCoded RepRank 0
Default

INSERT INTO Cost
SELECT t.JobID, t.PhaseID, 0
FROM Time AS t
LEFT JOIN Cost AS c
ON t.JobID = c.JobID
AND t.PhaseID = c.PhaseID
WHERE c.JobID IS NULL
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:03 PM.



Search Engine Optimization by vBSEO 3.3.0