Questions tagged as 'sql'

1
answer

Change WHILE by GROUP in SQL

I need an SQL function to get data grouped by month. I have in the column CPCCodeID codes (ex: 512456). I need to count and group for the first two digits. I need this separated for months (!!!) and to make it easier I did this loop that...
asked by 30.01.2018 / 17:38
1
answer

Error executing script

I'm trying to run the query below, but the following error occurs. "Converting a varchar data type to a datetime data type resulted in a value out of range." select MesID,Mes,Ano, convert(time,dateadd(second,SUM ( DATEPART(hh,(convert(...
asked by 30.01.2018 / 16:29
2
answers

Write data to a based table and two other tables

Hello! I am new to transact sql and would like and have the following situation. I have a tableA that has the column list of a second tableB. That's it! In table B the column names are the same as those stored in table A. Then you would use the...
asked by 25.01.2018 / 23:28
2
answers

SQL - Count number of records between rows

I need help with creating a query. I have a table that ranks people by week. PessoaId | Semana | Grupo ---------------------------- 1 | 1 | 1 1 | 2 | 1 1 | 3 | 1 1 | 4 | 1...
asked by 25.01.2018 / 23:47
1
answer

How to display two tables in SQLDeveloper at the same time?

I'm not able to filter two tables at a time in SQL Developer at the same time. When I insert two tables into it, sqldeveloper does not show anything!     
asked by 25.01.2018 / 20:57
2
answers

Problems with Laravel Query Builder

I'm having the following problem, when trying to implement a query with joins, in the query builder: My Query (pure SQL): SELECT COUNT(*) as total, orgao.sigla AS sigla_org_uni FROM protocolo INNER JOIN procedimento p ON protocolo.id_pro...
asked by 25.01.2018 / 14:40
0
answers

automatic platform for database in windows (sql server)

Good! I needed an automatic graphical platform for a sql server database on windows.     
asked by 31.01.2018 / 17:13
0
answers

Script to disregard null fields sql server

Hello, I have a table that has many columns (+ 80), I need a script to disregard the null fields and bring only those that have content. I do not want to use is not null, as it would have to list each column and there are many .... Can anyone...
asked by 25.01.2018 / 12:53
0
answers

Doubt in sql, join between tables and results

I'm doing a join between tables, where I need to return all rows from the first table, however I use a where to limit in the date field, so I end up limiting my result to only the rows that belong to that date specifies, thus causing n to return...
asked by 24.01.2018 / 13:25
1
answer

Compare two totals using LEFT JOIN in MySql

I have two tables: Venda and ProdutosVenda , where the Venda table has a field named 'Co_Id' and the ProdutosVenda , which stores the products of that sale, has a field called 'Id_Reference', which is the reference of t...
asked by 22.01.2018 / 14:13