Contact Us Today! | vcare@wdmtech.com

WDMtech

Topic-icon I'm trying read sql sentence to create a pie bar

More
05 Jul 2016 06:16 #2857

Hello Denise,
Please replace <> with != in your query.


Thanks
Daniel

Please Log in or Create an account to join the conversation.

  • Denise Bru
  • Denise  Bru's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
04 Jul 2016 16:20 #2853

This one is running perfectly in mysql
but into vchar NO running.

NO says sintax error but says

Forbidden

You don't have permission to access /administrator/index.php on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

SELECT `tipo`, sum(`total_valor`) FROM (SELECT `i3_ud_realizadas` as `tipo`, count(`i3_ud_realizadas`) as `total_valor` FROM `hs_memoria_centros` where `hs_control`= 1 and `i3_ud_realizadas` <> "" group by `i3_ud_realizadas` UNION all SELECT `i4_ud_realizadas`as `tipo`, count(`i4_ud_realizadas`) as `total_valor` FROM `hs_memoria_centros` where `hs_control`= 1 and `i4_ud_realizadas` <> "" group by `i4_ud_realizadas` UNION all SELECT `i5_ud_realizadas`as `tipo`, count(`i5_ud_realizadas`) as `total_valor` FROM `hs_memoria_centros` where `hs_control`= 1 and `i5_ud_realizadas` <> "" group by `i5_ud_realizadas` ) Derived GROUP BY `tipo` order by `tipo`

Please Log in or Create an account to join the conversation.

  • Denise Bru
  • Denise  Bru's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
04 Jul 2016 13:53 #2852

NOoo, I dont explain to you correctly. Pardon

The problem is into vchart.

Vchar dont allow to use UNION

Says ...

Forbidden

You don't have permission to access /administrator/index.php on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Please Log in or Create an account to join the conversation.

More
04 Jul 2016 13:01 #2851

It means the issue is with the Query not with vChart. We can also help you with the Query, But it would be paid support. Please contact our Sales team via Contact us form, We'll look into it.


Thanks
Daniel

Please Log in or Create an account to join the conversation.

  • Denise Bru
  • Denise  Bru's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
04 Jul 2016 12:52 #2850

No, in PHPMayadmin "UNION" no running because error in clausule GROUP.

If I write this YES
(SELECT `i3_ud_realizadas` as `tipo`, count(`i3_ud_realizadas`) as `valor` FROM `hs_memoria_centros` where `hs_control`= 1 and `i3_ud_realizadas` <> "" group by `i3_ud_realizadas` order by `i3_ud_realizadas`) union all (SELECT `i4_ud_realizadas` as `tipo`, count(`i4_ud_realizadas`) as `valor` FROM `hs_memoria_centros` where `hs_control`= 1 and `i4_ud_realizadas` <> "" group by `i4_ud_realizadas` order by `i4_ud_realizadas` ) union all (SELECT `i4_ud_realizadas` as `tipo`, count(`i4_ud_realizadas`) as `valor` FROM `hs_memoria_centros` where `hs_control`= 1 and `i4_ud_realizadas` <> "" group by `i4_ud_realizadas` order by `i4_ud_realizadas` ) order by `tipo`

But if I write the same but group by `tipo` to end myadmin says "error group clausule.
Then
table is like this
0 3
0 3
0 5
1 1
1 1
1 2
2 10
2 10
2 9
3 33
3 35
3 35

NO grupo three selects.

Thomas

Please Log in or Create an account to join the conversation.

More
04 Jul 2016 11:41 #2849

Hello,
Is the query working fine in PHPMyAdmin? And please let us know the error message you are getting.


Thanks
Daniel

Please Log in or Create an account to join the conversation.

  • Denise Bru
  • Denise  Bru's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
04 Jul 2016 11:13 #2848

For the moment I read only one column.
SELECT (CASE i5_ud_realizadas WHEN 0 THEN 'Ninguna' WHEN 1 THEN 'Una' WHEN 2 THEN 'Dos' WHEN 3 THEN 'Tres' ELSE 'nose' END) as tipo, count(i5_ud_realizadas) as valor FROM hs_memoria_centros where hs_control=1 and i5_ud_realizadas != "" group by i5_ud_realizadas order by i5_ud_realizadas

"i5_ud_realizadas" is the column but the other two columns are "i3_ud_realizadas" and "i4_ud_realizadas"

I've proved-->

(Select .......) UNION (Select ....) UNION (Select ....) but running
UNION ALL --> no running
CROP --> no running

Thomas

Please Log in or Create an account to join the conversation.

More
04 Jul 2016 11:07 #2847

Please share the query if login detail isn't possible.


Thanks
Daniel

Please Log in or Create an account to join the conversation.

  • Denise Bru
  • Denise  Bru's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
04 Jul 2016 10:35 #2846

I'm sorry. It's imposible give a backend and ftp user because this web site is a gobernamental web.

Can you help me using fields and like sample I sent you??

reg R1 R2 R3
Reg1 0 1 2
Reg2 1 0 0
Reg3 1 1 1
Reg4 1 3 2
Reg5 2 0 1
Reg6 1 2 1
Reg7 3 1 3

Optimal result will be other table like this.

Results Count
Value0 4
Value1 10
Value2 4
Value3 3

Please Log in or Create an account to join the conversation.

More
04 Jul 2016 10:09 #2844

Hello Denise,
Please share your backend & FTP login credentials via Contact us form, We'll look into it or just share the query.


Thanks
Daniel

Please Log in or Create an account to join the conversation.

  • Denise Bru
  • Denise  Bru's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
04 Jul 2016 09:47 #2843

Hello,

I'm trying to make a sentence complex sql and I cant do it

I have a table like this: (Only values from 0 to 3)

reg R1 R2 R3
Reg1 0 1 2
Reg2 1 0 0
Reg3 1 1 1
Reg4 1 3 2
Reg5 2 0 1
Reg6 1 2 1
Reg7 3 1 3

Optimal result will be other table like this.

Results Count
Value0 4
Value1 10
Value2 4
Value3 3

I've tryed with UNION but vchar says ERROR

Thanks

Please Log in or Create an account to join the conversation.