Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

inner join just one row

SELECT  a.*, c.*
FROM users a 
    INNER JOIN payments c
        ON a.id = c.user_ID
    INNER JOIN
    (
        SELECT user_ID, MAX(date) maxDate
        FROM payments
        GROUP BY user_ID
    ) b ON c.user_ID = b.user_ID AND
            c.date = b.maxDate
WHERE a.package = 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #join #row
ADD COMMENT
Topic
Name
2+1 =