N
N
Nana1232016-02-06 05:11:41
MySQL
Nana123, 2016-02-06 05:11:41

How to choose from 2 tables? MySQL?

da6e1341ccec43a69cd0c5d61fdde241.png
Good day to all, how to choose a name from 2 tables and, by its box number, select the number of its bananas for a specified date from 1 table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-02-11
@dkuser

Can be done with a subquery

select t2.name, 
(SELECT sum(bananas) from t1 WHERE t1.id=t2.id and t1.date = '2016.07.02') 
FROM t2 WHERE name = 'Denis'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question