Questions tagged as 'sql-server'

1
answer

Split between values - Query SQL Server 2012

Galera, in the query below, is as follows. Ano Mes Horas total_horas 2018 1 107 766 H 2018 1 225 766 H So, I want you to bring in another column the division of the column "Hours" by the column "total_horas", bringing this...
asked by 17.01.2018 / 14:15
2
answers

SELECT with repeated field

I'm having trouble executing a SQL query. The query is: SELECT DISTINCT CHAVE_FATO,COD_FILIAL,COD_DOCTO,NUM_DOCTO,DATA,VALOR_TOTAL,VALOR_LIQUIDO,COD_CLI_FOR,NOME_CLI_FOR,COD_VEND_COMP,NOME_VEND_COMP,COD_PRODUTO,DESC_PRODUTO_EST,NOME_SECAO,Q...
asked by 10.01.2018 / 13:16
1
answer

I can not create the connection to the bank in my php file

I'm trying to connect to the bank but only this error appears:    Fatal error: Uncaught PDOException: could not find driver in   C: \ xampp \ htdocs \ PDO \ Example-02.php: 3 Stack trace: # 0   C: \ xampp \ htdocs \ PDO \ Example-02.php (3):...
asked by 13.01.2018 / 23:28
1
answer

Create a Table-Relationship (N: N) that relates to a Table-Normal and another Table-Relationship (N: N) in SQL Server 2014 Management Studio

I'm trying to create this SQL Server Data Script, but when I run the following error message occurs:    Msg 1776, Level 16, State 0, Line 161 There are no primary keys or   candidates in the reference table 'tblSupplierInsumo' which   corresp...
asked by 20.01.2018 / 23:40
2
answers

Doubt about Querys

I'm trying to create a view to return the query from a Query. My problem is that I wanted it to return values for each product and it is returning the same value for the products. SELECT B.ID_Caso, B.Nome_Caso_Teste AS PRODUTO, (SELECT COUNT(S...
asked by 08.01.2018 / 13:26
1
answer

You are bringing the entire column and not just a specific id

I'm trying to get the last km registered in the bank of a specific vehicle, but it brings me all km and not a specific vehicle. My Controller: var Rota = ckm.ConsultaProduto(viewModel.NumCarroId); var maiorRota = Rota.OrderByDesce...
asked by 13.12.2017 / 17:48
1
answer

change ntext data type to text, SQL Server

I need to change the data type of a field that is in "ntext" to "text". The reason is that I'm having trouble pulling the value from the database and generating a PDF with the DOMPDF component of php. When trying to change command line: ALT...
asked by 19.12.2017 / 17:13
1
answer

Get the last table value from the database and display it in JTextField

I have a program here in the factory that, every 1 minute, an equipment connected to a supervisor sends a direct value into a table in the database (SQL Server). I would like to know how to always get the last value and display it in a JTe...
asked by 31.10.2017 / 12:51
2
answers

Select picking up previous line

What do I have to use in SQL SERVER 2008 to pick up the line before a certain closing. For example if in my where below if the alert is = 99 I want to know the alert and the speed before the alert. Speed Data Alerta 58 '...
asked by 30.10.2017 / 13:22
2
answers

Decreasing the value of two fields of a table and sorting according to the result

I have the field "killed" and "died" in the table, I need to make the order of the results come according to the decrease of these two values, My query looks like this: $woes = DB::table('woeplayerrank as woe') ->join('char', 'woe...
asked by 23.10.2017 / 21:20