Query Help

Please support our MS Access and FileMaker Pro advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Nov 2008
Posts: 4
Reputation: Shuco is an unknown quantity at this point 
Solved Threads: 0
Shuco Shuco is offline Offline
Newbie Poster

Query Help

 
0
  #1
Nov 27th, 2008
I am writing my first database app (windows form in c#) and I am using an access database.

I have 2 tables with the following fields:

payroll
--Store
--lastName
--PayFreq
--SSN (PK)
--HireDate
--EffectiveDate
--TermDate
--DeductionCode
--Deduction
--NAD CHAR

hrconnection
--Store
--lastName
--CoTime
--Plan
--Dependants
--HireDate
--EffectiveDate
--TermDate
--SSN (PK)
--Deduction

First two queries:
I want to find the records based on SSN that are in the payroll table and are not in the hrconnection tables and then find the record based on SSN that are in the hrconnection but are not in the paypal table

For these I came up with

SELECT hrconnection.Store, hrconnection.lastName, hrconnection.HireDate, hrconnection.EffectiveDate, hrconnection.TermDate, hrconnection.SSN, hrconnection.Deduction "
                                + "FROM hrconnection LEFT JOIN payroll ON hrconnection.SSN = payroll.SSN "
                                + "WHERE (((payroll.SSN) Is Null))";

and

SELECT payroll.Store, payroll.lastName, payroll.SSN, payroll.HireDate, payroll.EffectiveDate, payroll.TermDate, payroll.Deduction"
                               + " FROM payroll LEFT JOIN hrconnection ON payroll.SSN=hrconnection.SSN"
                               + " WHERE (((hrconnection.SSN) Is Null))";

They don't really come out right. So I thought I would post here for some help on the first queries and the following queries.


Next query:
I want to find data that does not match between hrconnection and payroll then output which fields do not match and list what record has the mismatch last name and SSN next to them.

Next query
I want to take all the records that do match 100% and are in both tables add the deduction field for all record and output a total deduction.

Next Query.
I want to output all records that match 100% and are in both tables that are within 45 days of the effective date and list how many days they are away from the effective date.

Any help on these queries would be great!

Thanks
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 306
Reputation: timothybard is an unknown quantity at this point 
Solved Threads: 26
timothybard's Avatar
timothybard timothybard is offline Offline
Posting Whiz

Re: Query Help

 
0
  #2
Nov 27th, 2008
What are the results of the two queries and how does it not match what you are expecting?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 4
Reputation: Shuco is an unknown quantity at this point 
Solved Threads: 0
Shuco Shuco is offline Offline
Newbie Poster

Re: Query Help

 
0
  #3
Nov 27th, 2008
The results I want is to show the mismatched records. It might do this , but does not look right as far as the first two queries and the others I am stuck on where to even go with them.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 4
Reputation: Shuco is an unknown quantity at this point 
Solved Threads: 0
Shuco Shuco is offline Offline
Newbie Poster

Re: Query Help

 
0
  #4
Nov 28th, 2008
Any help would be great
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for MS Access and FileMaker Pro
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC