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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:05:43+00:00 2026-05-17T16:05:43+00:00

SELECT BabyInformation.* , t1.* FROM BabyInformation LEFT JOIN (SELECT * FROM BabyData GROUP BY

  • 0
    SELECT BabyInformation.* , t1.* 
    FROM   BabyInformation 
    LEFT  JOIN
      (SELECT *  FROM  BabyData 
       GROUP BY BabyID 
       ORDER By Date DESC  ) AS t1 ON BabyInformation.BabyID=t1.BabyID

This is my query. I want to get the one most recent BabyData tuple based on date.
The BabyInformation should left join with babyData but one row per baby…

I tried TOP(1) but this worked only for the first baby

  • 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-17T16:05:44+00:00Added an answer on May 17, 2026 at 4:05 pm

    This should do it:

    SELECT bi.* , bd.* 
        FROM BabyInformation [bi]
        LEFT JOIN BabyData [bd]
            on bd.BabyDataId = (select top 1 sub.BabyDataId from BabyData [sub] where sub.BabyId = bi.BabyId order by sub.Date desc)
    

    I’ve assumed that there is a column called ‘BabyDataId’ in the BabyData table.

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

Sidebar

Related Questions

select count(*) as count from table group by foreign_id order by count This returns
select email from mailing list This is the query i want to use if
SELECT events.title FROM events ORDER BY events.title DESC I'm getting the proper ordering for
select picks.`fbid`, picks.`time`, categories.`name` as cname, options.`name` as oname, users.`name` from picks left join
SELECT sysobjects.xtype, syscolumns.name, sysindexkeys.indid, sysobjects.type FROM syscolumns LEFT JOIN sysobjects ON syscolumns.id = sysobjects.id
SELECT * FROM Table_A LEFT JOIN Table_B ON (Table_A.A_ID = Table_B.A_ID) INNER JOIN Table_C
SELECT User, COUNT(User) as count FROM Tests GROUP by User; This works. However, if
select * from table where key='çmyk' when i run this query on table that
SELECT * FROM CUSTOMERS WHERE RTRIM(ISNULL([SHORTNAME],'')) LIKE '%john%' I want to write this using
SELECT OrderNumber, FIRST(ShippingName) as ShippingName FROM Orders GROUP BY OrderNumber This gives an error,

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.