I need to join two tables to get the results I'm looking for. I've been working on this since yesterday and can't figure out whether or not I can achieve what I need in one query. I need to select ALL records that meet the DATE criteria from TABLE_A and ONLY the records that meet the DATE...
I need to select only the data in the rows with the most recent date.
Sample data
ITEM DATE ESTIMATE
0010 20070320 100.00
0010 20070321 65.00
0010 20070322 80.00
0020 20070316 75.00
0020 20070318 20.00
0030 20070316 30.00
0040 20070316 40.00
Desired result:
0010 20070322 80.00
0020 20070318...
I can handle joins when there are only 2 files involved, but I'm not sure what to do when I need to use 3 files.
Using the code below, my problem is that I'm not getting records when T1.TRF05 is blank because it doesn't have a matching record in T2. I need some data fields from T1 and T2...
The following code works fine when I run it with ONLY the blue code.
SELECT
PRPMED.NCONO AS COMPANY,
PRPMED.NSSNO AS SSN,
PRPMED.NEENO AS EMP_NO,
PRPMED.NAMDE AS DEDN_AMT,
PRPMED.NDENO AS DEDN_NO,
PRPMED.NDTJR AS JNRL_DATE,
HRPMBN.MNAMDE AS BENE_MATCH_AMT,
HRPMBN.MNBNTY AS...
I'm fairly new to SQL, so I'm not sure if my problem is something fairly simple or it's just not possible to do with SQL.
I have a query that gives me the information I want, but I need to limit the results based on an aggregate formula (I think that's what I want to do)
This is my present...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.