Questions tagged as 'query'

2
answers

Query with JOIN in 3 tables

I have the following tables: livroautor id idautor idlivro ------ ------- --------- 1 1 (NULL) 2 2 2 3 3 3 4 4 4 5...
asked by 08.08.2017 / 00:02
1
answer

Conversion is not valid

public int ObterTotalAcessos() { int obtertotal = 0; using (var connection = ServiceLocator.ObterConexao()) { var command = connection.CreateCommand(); command.CommandText = "SELECT SUM (ACESS...
asked by 13.10.2014 / 16:19
2
answers

Query SQL condition if

I have a problem in doing a query where I have 3 fields and only one of them is filled up that no longer shows this result. Can someone help me do this? select * from tabelas where campo1 and campo2 and campo3     
asked by 30.05.2014 / 17:24
3
answers

Place a hyphen when the value is 0 in select

How can I do in% with a mysql (SELECT) so that when the value is equal to query , replace it with 0 . Value field: int.     
asked by 21.02.2017 / 17:50
2
answers

Can a worse-cost query be a better-performing query?

Context Here in the company we have a very complex query that encompasses several business rules, for presentation in a WorkFlow and for now I am evaluating it in SQLServer . The performance of this query was poor and as the tables grew,...
asked by 25.09.2014 / 22:59
2
answers

SQL Left Join - smaller date greater than current date

3 tables: Processo , Evento , Alerta The goal is to make a query that returns all processes by adding the columns of the event type and date of the most recent event MAX(DataEvento) and the next alert (smaller date g...
asked by 25.05.2018 / 01:50
4
answers

SELECT with two results

Table: PEOPLE id - nome 1 - BEATRIZ 2 - MARIA 3 - CARLOS 4 - MARIA 5 - JÉSSICA 6 - HENRIQUE How can I make a SELECT that gives me a list with the names sorted by ID descendente , however, a certain NAME first and below the cont...
asked by 19.01.2018 / 12:24
2
answers

Problem with mysql_query, the data does not fall into the SQL database.

Hello, I can not execute this query, I have echoed this variable and all the data is being passed, but it does not enter my DB. When I copy the command and paste inside the phpMyAdmin query it works. Could someone give a help? Thanks! :) $s...
asked by 11.06.2018 / 20:27
1
answer

How to hide fields in queries using eloquent laravel using Join method

Of a question, I was given a way to query with child objects using the Join of eloquent, The query is below: $dados = Roda::join('veiculos', function($query) { $query->on('veiculos.id', '=', 'rodas.veiculo_id'); $query->where('ve...
asked by 17.10.2017 / 14:12
2
answers

Repeat previous rows when there is no record in SQL SERVER date

Friends, good afternoon! I came across a problem at work today, and I have not yet got a solution for it. As I do not have much experience in the database area I am having difficulty solving this problem, I would be very happy with a help, hi...
asked by 12.09.2017 / 22:17