Questions tagged as 'query'

1
answer

Not bringing records - SQL Query

Good afternoon! Galera, below is the query that is to bring the number of active clients in one column and the number of clients blocked in another column, but when executing the query, it is null in both columns. NOTE: When executing the sep...
asked by 21.07.2017 / 20:42
1
answer

Error - Query: The subquery returned more than 1 value

I'm new to SQL and I have the following error in my query: "The subquery returned more than 1 value. This is not allowed when the subquery follows a =,! =, & lt ;, < =, & gt ;, > = or when it is used as an expression ". The query is this:...
asked by 14.07.2017 / 14:16
1
answer

Tags in a table for each?

I have the table "noticia" and I'm going to make a system of tags, these tags will have to have a table for each or just a table?     
asked by 30.07.2017 / 18:13
2
answers

Comparison of two dates using varchar type MySQL

I have a question regarding the preparation of a SQL query in which I pass a registration date and check if it is larger than the current date, but I have a problem the date of registration is varchar and it follows the format "dd / mm / yyyy ",...
asked by 05.07.2017 / 20:26
1
answer

Revision in query

I have this query in order to list users with more comments, however, it can not display users with the banned column = true. SELECT * FROM usuarios a INNER JOIN topicos_comentarios b ON a.usuario = b.autor WHERE a.banido <> true GROU...
asked by 05.07.2017 / 23:01
1
answer

How to search a word in 10 tables in MySQL

I'm making a form for a search, and when I look for something, I want it to return various values from several tables that exist. As such, I would like to know the easiest way to do a query, which is not too heavy and can read all tables with...
asked by 20.06.2017 / 13:35
1
answer

Know result of count () in query

I have the following query in pdo: $ranking = $pdo->query("SELECT * FROM usuarios GROUP BY moedas ORDER BY count(moedas) DESC LIMIT 3"); I use this to make a ranking to know users with more coins. However, I am using a second query with...
asked by 29.06.2017 / 05:59
1
answer

Count the number of records of my IF

IF (count (UCID)> 1, count (UCID), '0') , it brings me approximately 500 record lines, being numbers 2 above, I want to be able to do a COUNT in that IF to display those 500's in a separate column. Anyone have a suggestion? Thanks in advance....
asked by 06.06.2017 / 20:23
1
answer

JOIN between tables with some of them empty

Good Night     I have 6 Tables (A, B, C, D, E, F) A tabela A sempre contém registros e tem uma chave primaria ID The other tables B, C, D, E, and F are all daughters of table A and have an FK_ID column that references the primary key of t...
asked by 14.07.2017 / 01:09
1
answer

Return data from my table formatting in html

I have a function inside my class to list data; Here is the code below: public function listadados(){ try{ //retornar um array $sql = "SELECT * FROM web_cadcli"; $lista = $this->con->conectar()-&g...
asked by 05.06.2017 / 01:41