Questions tagged as 'sql'

2
answers

Doubt with SELECT and SUB SELECT in MySQL

I have a question regarding SQL, I have never worked with sub-selects and I ended up getting lost with it. My SQL: SELECT CLI.id, CLI.nome, CLI.senha, CLI.email, CLI.cpf, CLI.celular, CLI.data_nasc, CLI.genero, CLI.data_cadastro, CLI.stat...
asked by 22.05.2018 / 14:54
2
answers

Cursor problem: SQL Server

I have a problem with the cursor part: cursor with the name 'BankBank' does not exist. sql code: if @Opcao='1' begin set @tipoPagamento='20' set @LayOut='040' declare C...
asked by 18.05.2018 / 13:33
2
answers

How to delete duplicate lines sequentially

I need help deleting the row that is sequentially duplicated, but not the duplicate amount of the same record in the table, for example rows 6 and 7, are with status repeats sequentially, then you would have to delete row 7, keeping intact lines...
asked by 07.11.2017 / 17:02
1
answer

compare dates within the sql query

I need to compare the date entered in the bank +10 days with the current date and display the student that the current date is greater than the 10 days, but this within the sql query. Is there any function for this? I tried this, without success...
asked by 14.11.2018 / 14:29
1
answer

delete column from select * [duplicate]

I have an api that returns the user's data in json, but wanted to return all the data except the password, would it have some way without being select in all fields except the password? I'm currently doing this: if ($autenticado) { $...
asked by 28.12.2017 / 12:33
1
answer

decimal places of a variable numeric field depending on the CASE in SQL

I have a query where, depending on a parameter, I need the result in a field to be 5 decimal places or 2 decimal places, is it possible in SQLSERVER 2008? Example DECLARE @VALOR DECIMAL(18,2), @PORCENTOJUROS DECIMAL(18,2), @CODJUROS INT S...
asked by 21.09.2017 / 22:33
2
answers

Record count

I have a table named cad_faltas , it has the fields: id int(11) id_cad_alunos int(11) falta varchar(8) idcurso int(11) The falta field receives the data AWAY and / or PRESENT. The question is, is there any possibility of doing a co...
asked by 20.09.2017 / 16:07
3
answers

Bring the most recent record with conditionals - PostgreSQL

I have a table with product information (product code, customer code, date of purchase, purchase value, etc.) and I need to pull the following information: 1- All customers that the last purchase was a specific product. That is, I need to ana...
asked by 02.04.2018 / 20:48
1
answer

java.sql.SQLException: Can not issue data manipulation statements with executeQuery ()

My key insertion is not being done. And the error it gives in the console is: java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086) at com.m...
asked by 18.04.2018 / 22:28
1
answer

SQL query with subquery and IN command

I need to do the following. So-and-so has several models of cars. I want to list other users who also have 3 specific models of car that so and so. What I did: $iduser = id do fulano $mod1 = modelo de carro 1 de fulano $mod2 = modelo de ca...
asked by 02.10.2017 / 08:05