SQL - Finding minimum value among table fields and joined fields -


This is an interesting and probably good general problem. How do I get the minimum time value associated with ID in a specific table? It is hard to explain without an example, so here's one:

  • Field ID in Step A, step 1_date, step2_data
  • Field A_ID (AID) in Table B1 I want to find the minimum value between Esteem 1_date, Estes 2_date, Date,
  • Field A_ID (Funk for AID), Date

in Table B2. B2.date for each ID in B1.date, A2

Any idea anyone?

Unfortunately, at least () function returns NULL < / Code> If any of its logic is NULL . And, maybe you want to use the left outer join for this purpose, if one of the B tables is not missing A_ID .

Here's a safe method:

  Choose from ID, from mind to mind (Select ID, All Union ID options, Step 2_Date, All of Union Select a_id, date from B1 union, pick date from B2) T-Group by ID;  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -