Note that there are some explanatory texts on larger screens.

plurals
  1. POstatistic syntax in access
    text
    copied!<p>I want to do some statistic for the <code>Point</code> in my appliation,this is the columns for <code>Point</code> table:</p> <pre><code>id type city 1 food NewYork 2 food Washington 3 sport NewYork 4 food ..... </code></pre> <p>Each point belongs to a certain type and located at the certain city.</p> <p>Now I want to caculate the numbers of points in different city for each type.</p> <p>For example, there are two types here :<code>food</code> and <code>sport</code>.</p> <p>Then I want to know:</p> <pre><code>how many points of `food` and `sport` at NewYork how many points of `food` and `sport` at Washington how many points of `food` and `sport` at Chicago ...... </code></pre> <p>I have tried this:</p> <pre><code>select type,count(*) as num from point group by type ; </code></pre> <p>But I can not group the by the city.</p> <p>How to make it?</p> <h2><strong>Update</strong></h2> <pre><code>id type city 1 food NewYork 2 sport NewYork 3 food Chicago 4 food San </code></pre> <p>And I want to get something like this:</p> <pre><code> NewYork Chicago San food 2 1 1 sport 1 0 0 </code></pre> <p>I will use the html table and chart to display these datas.</p> <p>So I need to do the counting, I can use something like this:</p> <pre><code>select count(*) from point where type='food' and city ='San' select count(*) from point where type='food' and city ='NewYork' .... </code></pre> <p>However I think this is a bad idea,so I wonder if I can use the sql to do the counting.</p> <p>BTW,for these table data,how do people organization their structure using json?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload