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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:59:26+00:00 2026-05-28T04:59:26+00:00

I have a schema like the following id (INT) Cycle_Number (INT) Cycle_Day (INT) Date

  • 0

I have a schema like the following

id (INT)
Cycle_Number (INT)
Cycle_Day (INT)
Date (date)


...other columns irrelevant to the question...

How can I get the row that has the max Cycle_Day within the max Cycle_Number

For example, say I have the following data

ID Cycle_Number Cycle_Day Date
1  1            1         2011-12-01
2  1            2         2011-12-02
3  2            1         2011-12-03
4  2            2         2011-12-04
5  2            3         2011-12-05
6  2            4         2011-12-06
7  3            1         2011-12-07
8  3            2         2011-12-08
9  3            3         2011-12-09

The query would return row 9. (It has the highest Cycle_Day within the highest Cycle_Number)

Thanks

  • 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-28T04:59:26+00:00Added an answer on May 28, 2026 at 4:59 am

    this one is compatible MySql 5.5 with no joint tables

    SELECT id
    FROM cycles
    ORDER BY Cycle_Number DESC , Cycle_Day DESC
    LIMIT 0 , 1
    

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the schema like the following: CREATE TABLE prop_set ( id INT UNSIGNED
I have a SQL table with the following schema: fruit_id INT price FLOAT date
I have a schema like this <h1> 5/2009 <br/> Question: This is the question
I have a schema design that looks like this: Table: User Row Column Family
I have reduced a complex schema to the following samples Students StudentID int, Name
I have the following schema, and would like to do a query that returns
Assume the following schema class Person{ public int Id {get;set;} public virtual ICollection<Province> Provinces
So I have the following method: private int? myIntField [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public int?
I have a model like the following: [Table(forms, Schema = mySchema)] public class forms
I have following table schema - CREATE TABLE [dbo].[TEST_TABLE] ( [TEST_TABLE_ID] [int] IDENTITY(1,1) NOT

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.