A
A
Andrey2015-02-01 14:12:35
MySQL
Andrey, 2015-02-01 14:12:35

How to write a SQL query to get the number of new records in a table?

Hello,
I need to solve the following question:
there are 2 tables
table1

  • id
  • name
  • text
  • user_id
table2
  • id
  • text
  • table1_id
  • read

read can be either 1 or 0 - read or not.
You need to make such a query to show all records from the first table, the number of records from table2 related to table1 by table1_id and the number of unread records in the read field.
And is it possible to fit all this into one request? Or is it better to change the table structure? if so, what is the best way?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2015-02-01
Haylov @scrolllocker

What exactly doesn't work for you? If you do not want to do it yourself, then contact freelancing .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question