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 8093523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:31:15+00:00 2026-06-05T20:31:15+00:00

wel if you have a mastertable any columns example mastertable columns createdon,modifiedon,name,id detailtable has

  • 0

wel if you have a mastertable any columns example
mastertable columns
createdon,modifiedon,name,id

detailtable has
createdon,modifiedon,name,id,mastertableid

now every month is added automatically a row on master
and it could have many rows on detail for this master, so
when one user doesn’t want to wait for next month he run the process which create
a new row on master, and others rows on detail.
so.so for this month i’ll have two masters,
now i need do a select only with year, and month
and if i do this select, this sum detail of first master generated automatically and the second master generated for user, now i dont want it happened, i want only one.
i dont mind if this is the last, or it is the first, so i need one

then my question is, how do i select the last master created?(for every month for every year)
so i dont mind if this last was created for user, or autimaticallity, only i need the last master, and its details

this is my current query but this select all

SELECT 
    createdby
    , createdbyname
    , createdbyyominame
    , createdon
    , createdonutc
    , createdonbehalfby
    , createdonbehalfbyname
    , createdonbehalfbyyominame
    , importsequencenumber
    , modifiedby
    , modifiedbyname
    , modifiedbyyominame
    , modifiedon
    , modifiedonutc
    , modifiedonbehalfbyname
    , modifiedonbehalfbyyominame
    , modifiedonbehalfby
    , ope_censoid
    , ope_name
    , ope_rutasid
    , ope_rutasidname
    , organizationid
    , organizationidname
    , overriddencreatedon
    , overriddencreatedonutc
    , statecode
    , statecodename
    , StatusCode
    , statuscodename
    , timezoneruleversionnumber
    , utcconversiontimezonecode  
FROM 
    ope_censo  
ORDER BY 
    ope_censoid
    , modifiedon

and i got this result with the last query

createdby                               createdbyname                createdbyyominame           createdon     createdonutc createdonbehalfby   createdonbehalfbyname   createdonbehalfbyyominame   importsequencenumber    modifiedby  modifiedbyname  modifiedbyyominame  modifiedon  modifiedonutc   modifiedonbehalfbyname  modifiedonbehalfbyyominame  modifiedonbehalfby  ope_censoid ope_name    ope_rutasid ope_rutasidname organizationid
71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-01 07:03:24.000 NULL    NULL    NULL    NULL    NULL    71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-01 07:03:24.000 NULL    NULL    NULL    NULL    581EB2D0-A24C-E111-97AC-005056977FBC    1 - Febrero - 2012  FF7C3DBD-3EBA-E011-8C48-005056977FBC    R 197 AGUA PURIF HOG LOC    F94F39E4-7C6B-E011-8C48-005056977FBC
71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-13 15:33:41.000 NULL    NULL    NULL    NULL    NULL    71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-13 15:33:41.000 NULL    NULL    NULL    NULL    63FFFF15-5856-E111-97AC-005056977FBC    13 - Febrero - 2012 FF7C3DBD-3EBA-E011-8C48-005056977FBC    R 197 AGUA PURIF HOG LOC    F94F39E4-7C6B-E011-8C48-005056977FBC
71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-24 00:29:27.000 NULL    NULL    NULL    NULL    NULL    71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-24 00:29:27.000 NULL    NULL    NULL    NULL    3D14A09B-7E5E-E111-97AC-005056977FBC    23 - Febrero - 2012 FF7C3DBD-3EBA-E011-8C48-005056977FBC    R 197 AGUA PURIF HOG LOC    F94F39E4-7C6B-E011-8C48-005056977FBC
71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-01 07:02:57.000 NULL    NULL    NULL    NULL    NULL    71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-01 07:02:57.000 NULL    NULL    NULL    NULL    7F53A7C4-A24C-E111-97AC-005056977FBC    1 - Febrero - 2012  CC7C3DBD-3EBA-E011-8C48-005056977FBC    R128 AGUA PURIF HOG LOC F94F39E4-7C6B-E011-8C48-005056977FBC
71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-13 15:33:28.000 NULL    NULL    NULL    NULL    NULL    71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-13 15:33:28.000 NULL    NULL    NULL    NULL    49540510-5856-E111-97AC-005056977FBC    13 - Febrero - 2012 CC7C3DBD-3EBA-E011-8C48-005056977FBC    R128 AGUA PURIF HOG LOC F94F39E4-7C6B-E011-8C48-005056977FBC
71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-24 00:37:06.000 NULL    NULL    NULL    NULL    NULL    71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-24 00:37:06.000 NULL    NULL    NULL    NULL    753C4BAD-7F5E-E111-97AC-005056977FBC    23 - Febrero - 2012 CC7C3DBD-3EBA-E011-8C48-005056977FBC    R128 AGUA PURIF HOG LOC F94F39E4-7C6B-E011-8C48-005056977FBC
71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-01 07:06:55.000 NULL    NULL    NULL    NULL    NULL    71D3CE46-1B71-E011-8C48-005056977FBC    Administrador CRM BBebidas  Administrador CRM BBebidas  2012-02-01 07:06:55.000 NULL    NULL    NULL    NULL    88650A4F-A34C-E111-97AC-005056977FBC    1 - Febrero - 2012  CD7C3DBD-3EBA-E011-8C48-005056977FBC    R129 AGUA PURIF HOG LOC F94F39E4-7C6B-E011-8C48-005056977FBC

so you could see for “rutaidname” i have 3 times to “R 197 AGUA PURIF HOG LOC” so
you could see createdon was created on february 2012 i wanted select the last for this
“rutasidname” and so, if this “rutaidname” has and other month (one o more rows) i want
the last for that month, so, i need for every “rutaidname” the rows where createdon was the last, for every month, for every year.
example for “R 197 AGUA PURIF HOG LOC” i want the last of february 2011, the last master for “march 2011” the lsat master for “april 2011”.

  • 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-06-05T20:31:16+00:00Added an answer on June 5, 2026 at 8:31 pm

    It seems to me like you just want the MAX date value grouped by month/year
    untested pseudo-code below:

    SELECT
        MAX(someDate) 
        , CAST(YEAR(someDate) AS VARCHAR(4)) + CAST(MONTH(someDate) AS VARCHAR(2)) AS yearAndMonth
    FROM
        someTable
    GROUP BY
        CAST(YEAR(someDate) AS VARCHAR(4)) + CAST(MONTH(someDate) AS VARCHAR(2))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm exhausted searching and reading all the licence options. Do any of u have
i try to show and hide divs on click but something isnt going wel
I have these tables in my database: Contacts -contact_id -contact_name File -file_id -file_code -customer_id
FindAncestor RelativeSource only supports 'Self' and 'TemplatedParent', but I have to bind the width
I've been using a system with imagettftext for a while now to add nog
I'm working on an online PHP application that has a need for delayed PHP
I have svg embeded in html. For svg embeded in html, ie&chrome do not
Hi I have a little problem. I'm using data binding to retrieve data from
I am using Carrierwave to upload the imgae, i have used in one model,
I can successfully compiled and run the Hello World code. Now I want to

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.