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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:43:21+00:00 2026-05-26T17:43:21+00:00

I have a table Mark with id and name fields and second table with

  • 0

I have a table Mark with id and name fields and second table with mark_id and two extra columns I’m interested in. I want to get all records from Mark table + priority for that mark and created_at. There might be several created_at values but I do not care much about them, I need just need one (first, whatever).

I tried this query which gives me too much records, 5 instead of 3 I expect.

SELECT 
    marks.*, 
    markings.created_at, 
    markings.created_at AS updated_at,
    markings.priority 
FROM `marks` 
JOIN markings 
    ON marks.id = markings.tag_id
WHERE (created_at > '2011-11-06 12:05:01') 
    AND (priority = 1) 
ORDER BY created_at;
  • 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-26T17:43:22+00:00Added an answer on May 26, 2026 at 5:43 pm
    SELECT 
        marks.*, 
        MIN(markings.created_at) as created_at, 
        MIN(markings.created_at) AS updated_at,
        markings.priority 
    FROM `marks` 
    JOIN markings 
        ON marks.id = markings.tag_id
    WHERE (created_at > '2011-11-06 12:05:01') 
        AND (priority = 1) 
    GROUP BY marks.col1, marks.col2, ... marks.coln, markings.priority
    ORDER BY created_at;
    

    where marks.col1, marks.col2, ... marks.coln would be marks.id, marks.name in your case if you don’t have more columns you don’t tell us about.

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

Sidebar

Related Questions

I have a table companies , which has two columns named name and address
i have a table named students which have student details id,mark,name i want to
I have two tables like this: table a: [id, name, roll, address, mark] table
I have table with 3 columns A B C. I want to select *
I have table in data base name train delay, with columns train number(int), DelayTime(int),
Suppose I have this table [Table1] Name Mark ------- ------ ABC 10 DEF 10
I have a table with 3 fields like this: ProfessorID StudentID Mark P1 S1
I have a table with columns: (project_id, name) It's a list of people, each
i have a table which Data is like userID name amount Date 1 mark
I have two columns in my Table called as Workers - Technicians. In Workers

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.