Questions tagged as 'query'

3
answers

Help with SQL query with COUNT in multiple lines

Hello, I'm doing the following query SELECT p.id, c.nome, v.titulo, count(v.titulo) FROM passageiros AS p LEFT JOIN clientes AS c ON c.id = p.id_cliente LEFT JOIN viagens AS v ON v.id = p.id_viagem GROUP BY v.titulo; And it is returning...
asked by 09.12.2018 / 04:37
1
answer

What are the differences between sql commands?

What's the difference, when should I use the following sql commands and which expressions can accompany these commands? order by ,group by, join e union What is the use and when should I use the commands below in a select? 1) where nomeda...
asked by 30.09.2014 / 12:02
2
answers

Create a query with grouping by month

I have a field in my database (dt_nf) which is type DATE. I would like to do a query that groups not by date, but by month and year, but I can not. My code looks like this: SELECT Sum(sjy_vendas.qtv) AS qt, Sum(sjy_vendas.rprd) AS rec, Sum(...
asked by 07.11.2018 / 10:59
2
answers

How to use multiple select in PHP form to query in MYSQL

I have a search with a select that can select more than one option, but I do not know how to do it so they search for all the selected options. Currently it does the search, it inserts the values in the url (I'm using GET ), but it can...
asked by 03.08.2018 / 14:51
2
answers

SQL Updating Wrong Value

I'm creating a QUERY to change every day of the dates recorded in the DB for the last day of the month of that record ... what happens is that when I play QUERY by selecting a record in month 5 (May) it updates the value of the day with 30 ......
asked by 03.08.2018 / 16:22
2
answers

type 'T' must be a reference type in order to use it as parameter 'TEntity' in the generic type or method

When I try to query using IQueryable , I receive the following error:    Error 3 The type 'T' should be a reference type in order to use it as   parameter 'TEntity' in the generic type or method   'System.Data.Entity.DbContext.Set ()' 1s...
asked by 12.07.2018 / 21:50
1
answer

Updating multiple lines and fields of Mysql

I set up a MySQL Query with the purpose of updating a multi-line field of my Mysql table. It was as follows: update produtos set (nome) = case codigo when 5 then 'teste 1' when 6 then 'teste 2' when 7 then 'teste 3' where codigo in (5,6,7)...
asked by 20.03.2018 / 15:35
1
answer

PostgreSQL: Catching bugs and hits

I need a query to get the number of errors and hits from this table.     
asked by 15.05.2018 / 21:41
1
answer

How to use aggregate functions in a WHERE?

I'm doing college work on Database, and one of the Query I should do is this: Show all lenders who have had a larger total purchase that R $ 5000.00; I tried: SELECT NomeCredor, SUM(Compras.Valor) FROM Credores, Compras WHERE (...
asked by 11.12.2017 / 18:41
2
answers

Regex in MySQL to fetch certain results from X time

I have a field in the table set to DATE and the data is saved in this field as follows: year-month-day hour: minute: second Exemplo: 2014/04/22 18:32:00 I need to develop a query that returns me only given year / day / month. A scheme:...
asked by 27.04.2014 / 18:39