Questions tagged as 'sql'

2
answers

doubts with select sum () Mysql

I have these two tables, January and February: Eachfieldcorrespondstothedayofthemonth,d1=day01,etc.Ineedtocreateaselectthatshowsthemonthlyvalueofeachaccountplan,forexample: How would this sql be?     
asked by 18.03.2017 / 21:52
2
answers

Get number of elements depending on the maximum number of elements per group [closed]

I have two tables and I want to get the name of the A table depending on Num3 . For example, in the A table, we have num2 and in the B table there are values corresponding to Num1 . What I want i...
asked by 06.12.2016 / 23:51
1
answer

List by foreign key MySQL and Java

I'm trying to select the dvds that the member registered but I'm not getting it, I would like to know if someone can help me, the result of my code returns so Result: 1 - null - null - null - null - null - null - 2 And only one result appea...
asked by 31.05.2015 / 00:41
2
answers

Comparison between decimal numbers

I have 2 posts in a table, with prices 500.00 and 88.98. When I run to sort at the highest price, Mysql returns me that 88.98 is greater than 500.00, the price field is a string, why does this happen?     
asked by 16.12.2016 / 06:44
2
answers

SQL + Left Join

I have 3 tables produto , carrinhoProduto and venda I wanted to know the products that did not sell in the year 2015 : SELECT p.idProduto,p.descricao as 'Produto',datepart(year,v.dataVenda) as 'Ano' FROM Venda v INNER...
asked by 10.12.2016 / 03:35
1
answer

How to make multiple execute with PDO

I have a very simple user update form, but I'm not able to successfully update using PDO and mysql. Here is the snippet of code I'm having trouble with: if (isset($_POST['ID'])){//Se informar o ID do usuário que deseja modificar $senh...
asked by 23.10.2017 / 13:01
1
answer

Sql, sum of several counts

Hello, I have a bank with 3 important tables, state, city and orders I need to rank the states of the one that has the most requests to have less, but the orders are only related to the city table. so I need to make a count for each city and add...
asked by 10.09.2018 / 15:41
1
answer

Calculate SQL mean with hour field

Good morning, I am having trouble resolving the select below. I have the select below that returns me the amount of hours of a given event and apparently returns in varchar. What I'm having difficulty is to take this amount of hours and divide b...
asked by 05.07.2018 / 16:41
2
answers

Error in insert with ADOCommand

In Delphi XE4, SQL Server 12, connected by ADOConnect . ADOCommand1.commandText being 'insert into tabela (a,b,c) (1,1,1)' Works as expected if a record already exists. But if it is the first record the message appears:...
asked by 04.05.2014 / 14:03
1
answer

Sql similar to Excel's PROCV

In excel there is the PROCV function, where I can get close values by comparing columns. Ex: A B Nome Dinheiro Maria 200 João 1000 D E F Categoria Min Max Médio...
asked by 06.04.2016 / 23:02