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

  • Home
  • SEARCH
  • 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 868225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:06:15+00:00 2026-05-15T10:06:15+00:00

I have a table with records as, in example data below a CO.Nr are

  • 0

I have a table with records as, in example data below a CO.Nr are TH-123,Th-456 and so on… I need to collect the data..

Nr.       CO.Nr           Employee       Resp            Description       Date

1         TH-123          ABC            NULL              HELLO           10.05.2010
2         TH-123          NULL           S14               NULL            18.05.2010
3         TH-123          DEF                              NULL            13.05.2010
4         TH-456          XYZ            NULL              NULL             1.07.2010
5         TH-456          NULL           S19               SOME             NULL
6         TH-456                                           TEXT            08.05.2010
7         TH-456                        NULL                               28.05.2010

For TH-123,
If Nr. is maximum, that is the record i need to start with group by CO.Nr, so it is the record with Nr as 3,
if the value in the other columns is NULL or space, go to a record above that is the record with Nr as 2, even if it has null value go to a record above that record with Nr. as 1 in this case.
In the 3 records i need to take the maximum of date.
For the above data, i need to have output as,

      CO.Nr           Employee       Resp            Description       Date

      TH-123          DEF            S14               HELLO            18.05.2010
      TH-456          XYZ            S19               TEXT             01.07.2010

Thanks in advance!

  • 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-15T10:06:16+00:00Added an answer on May 15, 2026 at 10:06 am

    You can do it many ways

    select [co.nr],
    (select top(1) employee from mytable b where b.[co.nr]=a.[co.nr]  and 
                            employee is not null order by nr desc) as employee,
    (select top(1) resp from mytable b where b.[co.nr]=a.[co.nr]  and 
                            resp is not null order by nr desc) as resp,
    (select top(1) description from mytable b where b.[co.nr]=a.[co.nr]  and 
                            description is not null order by nr desc) as description,
    (select max([date]) from mytable b  where b.[co.nr]=a.[co.nr]) as Date
    from (
    select distinct [co.nr] 
     from mytable ) as a
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone have sugestion or example on how displaying Google Datastore records table with pagination
I have three records in a table example: *Usernames* *email* *city* Nick nick@example.com London
I have a table that contains records with a column indicates the Date. Given
I have to get the records from a table field where Length of record/data/string
I have a data set of a 1m+ records. I need to output the
I have following Table with records for ActivityLog: ID, UserId, Category, Created 1 11
I have in my table records that are related one to another by a
i have two table. Records and Villas Records table : ID, VID (Villa ID),
I have table a joining table b, I only want the records from table
I have table with 300 000 records (MyISAM). I get record from this table

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.