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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:41:23+00:00 2026-06-13T17:41:23+00:00

I have 2 tables transfers and equipment where there could be multiple transfers for

  • 0

I have 2 tables transfers and equipment where there could be multiple transfers for each piece of equipment. I’m looking to join these 2 tables with a project id and return the latest transfer for each piece of equipment for a specific project.

transfers table:
tid, pid, eid, date

equipment table:
eid, ename

In my function I’m sending the variable $pid to sort out just the equipment transfers for a specific project id that is stored with the equipment id in the transfers table.

  • 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-13T17:41:25+00:00Added an answer on June 13, 2026 at 5:41 pm

    I think your requirements may still be a little unclear to me, but to return only the latest “Transfer” & “Equipment” rows for a specific PID, perform the following:

    SELECT t.tid, t.pid, t.eid, e.ename, t.date
      FROM transfers t
      JOIN equipment e ON t.eid = e.eid
     WHERE t.pid = ?
       AND t.date = (SELECT MAX(t2.date) FROM transfers t2 WHERE t2.pid = ? )
    

    Let me know if this does what you’re hoping it will do. If not, give me a little bit more information on the rows that would be in each of the tables.

    Hope this helps,

    john…

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

Sidebar

Related Questions

I have a query that transfers data from multiple slave tables into a single
I have two tables emp_master and transfer. for each employee_id in emp_master there can
I have tables like these two test_table date student test 2012-05-31 Alice Math 2012-05-31
I have an SSIS package that transfers some tables to CSV files on a
I have a few tables, each with a binary column with a specific size,
I have 3 tables that have same columns,but different data ( deposits,withdrawals,transfers ) CREATE
I have tables A and B with identity PKs ida and idb : ex
I have tables like this: tblUsers int UserID string UserName tblUsersInRoles int UserID int
I have tables linked by FK, I query on the first table using entity
I have tables named news and tags_news. Given a news id I have 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.