MySQL Forums
Forum List  »  Newbie

Re: Using two tables with DATEDIFF
Posted by: Sr Cookie
Date: May 15, 2016 09:36PM

The detail is that in the table b I tehho several times the same ID, so I need to collect the oldest information from these IDs (which was inserted first), so I thought to do with the select (using LIMIT 1). With his example of JOIN got to work, but the problem is that in the second table is not being picks up the entry that has the newest data from the fields like ID.

The reality is I need to do a subtraction between the opening of an occurrence of a system (table1.date) and first user interaction in the call (table2.date) but in table2 may be multiple entries of the same call (same ticket ID) so I need to get the younger.

Table 2 Structure:
id (pri), tickets_id, date, content

In the second table was colentando information that has the earliest date (which was inserted first) like this:

SELECT date FROM table2 WHERE id = XXX LIMIT 1;

Any suggestion?

Thank you

Options: ReplyQuote


Subject
Written By
Posted
Re: Using two tables with DATEDIFF
May 15, 2016 09:36PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.