hi my friend u know ... look i have this in mysql

+--------------+---------------------+
| id_respuesta | respuesta           |
+--------------+---------------------+
|            1 | excelente           |
|            2 | bueno               |
|            3 | regular             |
|            4 | malo                |
|            5 | si                  |
|            6 | no                  |
|            7 | no respondio        |
|            8 | recomendacion       |
|            9 | anuncio revista     |
|           10 | letrero carretera   |
|           11 | google              |
|           12 | directo al hotel    |
|           13 | llamada al 800      |
|           14 | sitio web del hotel |
|           15 | sitio web de otros  |
|           16 | agencia de viajes   |
|           17 | otros               |
+--------------+---------------------+

and i have this another table ::

+------------+-------------------------------------------
+---------+
| id_aspecto | aspecto
| id_area |
+------------+-------------------------------------------
+---------+
|          1 | como supo de este hotel                                 |
    1 |
|          2 | como fueron atendidas sus reservaciones      |       2 |
|          3 | a travez de que medio hizo su reservacion     |      2 |
|          4 | botones
      |       3 |
|          5 | recepcionista
     |       3 |
|          6 | telefonos
        |       3 |
|          7 | seguridad
       |       3 |
|          8 | limpieza
         |       4 |
|          9 | mantenimiento
     |       4 |
|         10 | atencion de la camarista
 |       4 |


and when i want to try this  its ok::

SELECT b.id_respuesta , COUNT(b.id_respuesta) AS cnt, b.id_aspecto
FROM huesped a, rompe_encuesta b
WHERE
b.id_huesped = a.id_huesped AND
((b.id_aspecto = 1 AND b.id_respuesta >= 1 AND b.id_respuesta <= 17)
OR
(b.id_aspecto = 2 AND b.id_respuesta >= 1 AND b.id_respuesta <= 17))
AND
a.fecha BETWEEN '2012-12-01' AND '2012-12-12'
GROUP BY b.id_respuesta;
this query displays this result:

+--------------+-----+------------+
| id_respuesta | cnt | id_aspecto |
+--------------+-----+------------+
|            1 |           1 |          2 |
|            2 |           2 |          2 |
|            3 |           1 |          2 |
|            4 |           1 |          2 |
|            7 |           3 |          2 |
|            8 |           3 |          1 |
|            9 |           1 |          1 |
|           10 |          1 |          1 |
|           11 |          3 |          1 |
+--------------+-----+------------+


but when i try the next part ::::: its wrong:: i think that its because
.... id_aspecto=1 has id_respuesta between 8 and 11,,,
and id_aspecto=2 has id_respuesta between 1 and 7...  and id_aspecto = 3
has id_respuesta between 12 and 17...
but id_aspecto =4 has too id_respuesta between 1 and 7....

SELECT b.id_respuesta , COUNT(b.id_respuesta) AS cnt, b.id_aspecto
FROM huesped a, rompe_encuesta b
WHERE
b.id_huesped = a.id_huesped AND
((b.id_aspecto = 1 AND b.id_respuesta >= 1 AND b.id_respuesta <= 17)
OR
(b.id_aspecto = 2 AND b.id_respuesta >= 1 AND b.id_respuesta <= 17)
OR
(b.id_aspecto = 3 AND b.id_respuesta >= 1 AND b.id_respuesta <= 17)
OR
(b.id_aspecto = 4 AND b.id_respuesta >= 1 AND b.id_respuesta <= 17))
AND
a.fecha BETWEEN '2012-12-01' AND '2012-12-12'
GROUP BY b.id_respuesta;

this query dysplays this result :

+--------------+-----+------------+
| id_respuesta | cnt | id_aspecto |
+--------------+-----+------------+
|            1 |          5 |          2 |
|            2 |          2 |          2 |
|            3 |          1 |          2 |
|            4 |          1 |          2 |
|            7 |        11 |          2 |
|            8 |          3 |          1 |
|            9 |          1 |          1 |
|           10 |         1 |          1 |
|           11 |         3 |          1 |
|           12 |         1 |          3 |
|           13 |         1 |          3 |
|           15 |         1 |          3 |
|           17 |         1 |          3 |
+--------------+-----+------------+ in this id_aspecto is not here.. and
has not id_respuesta... but when i do this look.::


select b.id_respuesta, count(b.id_respuesta) as cnt
from huesped a, rompe_encuesta b
where b.id_huesped = a.id_huesped and
b.id_aspecto = 4 and
b.id_respuesta >= 1 and
b.id_respuesta <= 17 and
a.fecha between '2012-12-01' and '2012-12-12'
group by b.id_respuesta;

and the result is this:

+--------------+-----+
| id_respuesta | cnt |
+--------------+-----+
|            1 |           4 |
|            7 |           4 |
+--------------+-----+
the id_aspecto=4 has 2 id_respuesa ......... example cnt is the number of
persons that answered that id_aspecto=4 said that the service is
id_respuesta=1(excelent)...

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to 
google-visualization-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to