how to do this

i have this problem.

I have 3 columns in the table and each of these is filled with integers from 1 to 8.In one row can be one number just once and same integers in different rows can be in different columns.for example: 1st row: 1,5,3 2nd row:3,4,5 ....
What i want to do is to get an result which will tell me how many rows contains 1,in how many rows is 2, ......8

Is it possible to do it with one select+count(*)+groupBY, or what are the possibilities.

One facility can be located in three defferent geographical areas, which are identificated by columns loc_1,loc_2,loc3.In one row, there can be one location used just once.But for ex. area no.5 can be in loc_1 for one facility, but for another , it can be in loc_3, so rows of the table can look like this:

It sounds like you'll make things a lot easier if you break up your repeating columns into a separate table.

What I would do is remove loc_1, loc_2, and loc_3 from your table (for example, facility_location), and create a new table with 2 columns:
a foreign key to facility_id and then location_id with a composite primary key of facility_id and location_id.

To get the stats for amount of types of facilities at a given location do something like*note I did not explicitly test this query, but it should give you something to go off of):