Good morning, I have a problem with this question: The actual results of this query: | Pergunta | Resposta | Qtd | These are the results I was hoping for: | Produto | Região | Qtd | I am using pivot and UNPIVOT operators, but the result is not satisfactory. Has anyone had to face this situation beforehand? li> Att, Pelegrini < code> Pergunta, North, COUNT (*) aS include selection as the IP.nome Qtd P.txt_nome from tb_resposta_formulario RF insider formularios F.id_formulario = RF.id_formulario insider F which P.id_pergunta on tb_pergunta P = including RF.id_pergunta join interiors are Tb_resposta_formulario_combo RFC on RFC.id_resposta_formulario = RF.id_resposta_formulario INP INP on Aipikaidi_aitem_prgun = Arfsikaidi_aitem_prgun where Arfkaid _ Formulaaru = 2 Group Piktiktiktikti.an.am.amk, Aipiknam
Produto | Combo 1 mb | 3 |
Produto | Combo 2 MB | 5 |
Produto | Combo 4MB | 1 |
Produto | Combo 6MB | 1 |
Produto | Combo 8MB | 4 |
Régio | MG | 3 |
RegioO | Pr | 2 |
Régio | RJ | 3 |
Régio | SC | 1 |
Régio | SP | 5 |
Combo 1 mb | MG | 3 |
Combo 2 MB | SP 5 |
Combo 4 MB | Scheduled Caste | 1 |
Combo 6 MB | RJ | 1 |
Combo 8 MB | Pr | 2 |
text after
"clear" answer: Because the query is wrong we really do not know anything about the table structure and what you are trying to achieve.
At least one very basic problem in your query: You are expecting the column | Produto | Northeast Qtd |
in your answer, even though the question is clearly selected columns Pergunta ,
Qtd
, Which you are getting results with matching
How well are you familiar with SQL? To read an introductory text may be worth it I was suggested as a good introduction (using Oracle, but the principles are the same)
Comments
Post a Comment