Questions tagged as 'query'

1
answer

List grouped and filtered data

I am doing a query in PUBS, the database that is used in the MSDN tutorials for SQL Server, and I can not find a way to do it. The two tables I use are publishers and titles that have published book information and their publishers. I...
asked by 07.07.2014 / 19:28
1
answer

How to use order by stop ordering the names of the months in Oracle

Hello, I'd like to know how to solve this problem. I would take the name of the days of the month and order them and not the numbers of the corresponding months. It follows the query that I performed but that only orders in numbers corresponding...
asked by 05.12.2018 / 20:44
1
answer

Add subquery values separately

I have a problem with this query below: select sum(tb1.l1) * 0.3, sum(tb2.l2) * 0.3 from ( select setor, total_geral as l1 from mobile.auditoria where month(data) = month(now()) and year(data) =...
asked by 18.10.2018 / 16:37
1
answer

NodeJs query in SQL Server

Hello everyone, I need to do a filtered query for days in SQL in a NodejS application, but during the POST that is when I make the NodeJs filter I am accused of a value conversion error. When I run get get myself to retrieve the values of the Dat...
asked by 21.09.2018 / 17:17
1
answer

Using data from one select within another?

Two tables tbl_orcamento and tbl_itens the table budgets have a column with the following statuses. 1 = orcamento aprovado 2 = ordem de compra emitida 3 = ordem de compra aprovada The tbl_itens has some columns I will l...
asked by 24.04.2018 / 20:35
1
answer

Group Data with Preference-MYSQL

I'm trying to group rows equal, but based on a value. I know it is possible through sub-query , however as I am using inner join I could not apply. SELECT * FROM Concessionarias C inner join Concessionarias_Marcas CM on C.id =...
asked by 23.12.2017 / 05:59
1
answer

How to fetch data from one table using reference from others?

I'll illustrate with one simple thing ... I have a 'products' table that has columns, id, product_name, value. I have another table 'users' columns, id, name. And another table 'user purchases' id, id_user, product_id, product_name, this thir...
asked by 26.09.2017 / 16:31
1
answer

(SQL) Add "count 0" when you do not have a record

Hello, I'm picking up a query in the database where I need to get how many subscribers have registered in a tournament, the problem is that I also need to bring the tournaments that do not have subscribers yet ... I can not think of the logic by...
asked by 07.05.2018 / 19:21
1
answer

I need to select sequences of numbers in a field of a table column

I have a 'Text' column in my 'process' table. Text consists of a VARCHAR (220), in this text I need to identify a specific word pattern. In this case a sequence of numbers with a "-" to separate: '1234-567' - There are 4 digits followed by '...
asked by 05.04.2017 / 18:22
1
answer

SQL - How to make multiple INSERTs in a table with the result of a SELECT * of another table in a query

Hello, I would like to know how to make multiple INSERTs in a table with the result of a SELECT of all ids of another table table that are not as foreign key in the first table. I already have the SELECT query with LEFT JOIN: SELECT id FROM...
asked by 30.10.2017 / 14:28