Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7692315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:49:32+00:00 2026-05-31T20:49:32+00:00

I need to fetch only first record (because I need last date) of resultset,

  • 0

I need to fetch only first record (because I need last date) of resultset, at the moment I have this resultset from this sql tring:

SELECT BCACC,FLDAT
FROM ANAGEFLF
ORDER BY FLDAT DESC

and I see this record:

A.M.T. AUTOTRASPORTI SRL        20080220
A.M.T. AUTOTRASPORTI SRL        20080123
A.M.T. AUTOTRASPORTI SRL        20070731
APOFRUIT ITALIA                 20080414
APOFRUIT ITALIA                 20080205
APOFRUIT ITALIA                 20071210
APOFRUIT ITALIA                 20070917
APOFRUIT ITALIA                 20070907

now I need to take only one record (first) for every BCACC, I would take this resultset:

A.M.T. AUTOTRASPORTI SRL        20080220
APOFRUIT ITALIA                 20080414

I’ve just try group it for BCACC but I receive an sql error, I’m workin on DB2 ibmI

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:49:33+00:00Added an answer on May 31, 2026 at 8:49 pm

    Assuming they are the only fields involved, you can just do a GROUP BY.

    SELECT
      BCACC,
      MAX(FLDAT) AS FLDAT
    FROM
      ANAGEFLF
    GROUP BY
      BCACC
    

    If, however, you have other fields that you need, then you just join this back of the table as a sub-query…

    SELECT
      ANAGEFLF.*
    FROM
      ANAGEFLF
    INNER JOIN
    (
      SELECT
        BCACC,
        MAX(FLDAT) AS FLDAT
      FROM
        ANAGEFLF
      GROUP BY
        BCACC
    )
      AS map
        ON  map.BCACC = ANAGEFLF.BCACC
        AND map.FLDAT = ANAGEFLF.FLDAT
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to delete only the first appear of a record. This have a
I need to fetch a sheet from excel to a datatable. I first tried
Hi, I have a linq to sql question like this : tmpAdList1 = (from
I need to fetch data from normalized MSSQL db and feed them in Solr
Lets say I need to fetch some records from the database, and filter them
Here's what I need to fetch: - posts that have comments - number of
Im using vb.net and I need to fetch data from two different tables and
First I want to thank you guys here, because your posts have gotten me
I want to echo only the first 10 rows, but I need to count
I need to perform this Oracle query in SQL Server: select case_id, channel_index, min(su_min)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.