B
B
beduin012015-06-05 21:00:15
SQL
beduin01, 2015-06-05 21:00:15

What is the best way to fetch from a database?

I want to draw statistics on the site for keywords. The statistics itself is stored in the
Date Word How ManyDayDayMet
Example:
2008-08-21 Vasya 5
2008-08-21 Petya 1
2008-08-21 Vova 2
2008-08-22 Vasya 3
2008-08-22 Petya 1
2008-08-22 Vova 1
Actually I want to write a simple rest interface that would give this data to a JS script, but here's the question. How to do it better? Is it possible to give this data somehow in json format? Or is another form of return needed? There is also a key-value, and here there is also a frequency of occurrence.
The output should just be a graph.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2015-06-05
@beduin01

[ 
    {"date": "2008-08-21", "name": "Вася", "count": "5" },
    {"date": "2008-08-21", "name": "Петя", "count": "1" }
]

E
evnuh, 2015-06-05
@evnuh

Select data, wrap it in JSON, send it to JS. What is the problem? Apparently, not in the courses, what is JSON?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question