Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query from query

Status
Not open for further replies.

Reggie2004

Technical User
Oct 4, 2004
45
US
I am writing a query from a query. This is the code
SELECT [Why not workable].[SSN P ], [Why not workable].TXPD, [Why not workable].[LFRZ-RFRZ], [Why not workable].[TC-150], [Why not workable].[TC-290], [Why not workable].[TC-291], [Why not workable].[TC-300], [Why not workable].[TC-301], [Why not workable].[TC-420], [Why not workable].[TC-421], [Why not workable].[TC-424], [Why not workable].[TC-530], [Why not workable].[TC-540], [Why not workable].[TC-590], [Why not workable].[TC-591], [Why not workable].[TC-594], [Why not workable].[TC-599], [Why not workable].[TC-976], [Why not workable].[TC-977], [Why not workable].[ DOB ], [Why not workable].[ DOD ]
FROM [Why not workable]
SELECT FROM Why not workale
Where TXPD = (SELECT MIN(TXPD)FROM Why not workable)
GROUP BY SSN P
HAVING SSN P >1;

What I am trying to do is this... When I have multiple years (TXPD), I want to remove the earliest one. I think I am on the right track. But I cannot get this to work.
SOME ONE ANY ONE PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!!

Reg
 
Code:
SELECT [Why not workable].[SSN P       ],
 [Why not workable].TXPD,
 [Why not workable].[LFRZ-RFRZ],
 [Why not workable].[TC-150],
 [Why not workable].[TC-290], 
[Why not workable].[TC-291], 
[Why not workable].[TC-300],
 [Why not workable].[TC-301],
 [Why not workable].[TC-420], 
[Why not workable].[TC-421], 
[Why not workable].[TC-424],
 [Why not workable].[TC-530],
 [Why not workable].[TC-540], 
[Why not workable].[TC-590], 
[Why not workable].[TC-591],
 [Why not workable].[TC-594],
 [Why not workable].[TC-599],
 [Why not workable].[TC-976],
 [Why not workable].[TC-977],
 [Why not workable].[  DOB     ],
 [Why not workable].[ DOD      ]
FROM [Why not workable]
Where TXPD = (SELECT MIN(TXPD)FROM [Why not workable])
GROUP BY [SSN P]
HAVING [SSN P] >1

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
The exact error I get is "You tried to execute a query that does not include the specified expression 'TXPD' as part of an aggregiate function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top