Questions tagged as 'query'

0
answers

How to return a MAP using nativeQuery from JPA?

I need to consult a bank that is already created, populated, and maintained by another application. So I do not have the entities in my project and I did not even want to create them. I'm using Spring Boot with JPA. Here is an example code:...
asked by 21.05.2017 / 22:26
1
answer

Multiquery PHP PDO - SQL Server 2012 - IIS 8.5

Is there a problem in running multiple queries with the same PHP PDO code? Example: <?php // Retorna $con include 'conexao.php'; // Suponhamos que dbo.minha_tabela tenha apenas três campos, sendo um deles a chave-primária auto increm...
asked by 11.01.2017 / 19:04
1
answer

MYSQL - Select 2 tables

Good morning everyone! I'm having a problem querying MYSQL, and the query I'm using is not displaying the results you want. Here's the example: TABLE: CLIENTES (codigo_cliente, nome, cnpj) TABLE: HISTORICO_CONTATOS (protocolo, co...
asked by 08.11.2016 / 14:08
1
answer

call method in laravel query

I have this query here: SELECT p.descr, p.dt_hr, f.id_friend FROM users u JOIN friends f ON u.id = f.id_user JOIN posts p ON p.id_user = f.id_friend WHERE u.id = 1 It returns me this: I'mwantingtospinintheforeachandmountanarraysomething...
asked by 29.12.2016 / 14:34
1
answer

access - query subtraction doubles values

I coded the following queries: SomaEntradasTtais: SELECT artigos.Nome, Sum(Entradas.quantidade_ent) AS [Total Entradas] FROM artigos INNER JOIN Entradas ON artigos.Cod_artigo = Entradas.Cod_artigo GROUP BY artigos.Nome; SomaSaidsTotal:...
asked by 30.06.2016 / 11:07
1
answer

Setting limit for query with UNION in MySQL

I would like to know how I create a limit for a query that uses UNION in MySQL, in my case I want to set LIMIT 5 to the following query: $friends_a = mysql_query("(SELECT * FROM users WHERE id!='$user_q[id]' AND id='$friends_1_q[...
asked by 29.01.2016 / 21:35
2
answers

PHP - How do I make the left join with more than one record in the other tables not return repeated values in the columns? [closed]

I need to perform a SQL query in PHP, where I need to create a table from other 9 tables, joining all the columns with a LEFT JOIN, and with the 'Client' field as the key between the tables. However, in each table there is more than one record o...
asked by 11.01.2016 / 16:59
1
answer

Query with parameter causing timeout

I have a query that when executed with ADO.NET takes less than a second to return your data. When adding parameters to this query, the return remains the same. However, when adding a parameter of type datetime , the query does no...
asked by 08.03.2016 / 15:05
1
answer

SQL Sum for periods

I'm having a question for the following query: In my sales table I would like to return the sum by period of a given product. Today I'm doing it this way: select YEAR(venda.data_venda) as Ano, venda.codprod_venda as CodigoProduto, produtos....
asked by 05.09.2015 / 21:56
1
answer

Add multiple fields from the same table in the same query

I have an "X" table with several fields and one of the fields is "date" and the other is "type". In the same query I need to return the following: - Number of registrations in April - Number of records in April with type 1 - Number of reco...
asked by 20.05.2015 / 17:36