Questions tagged as 'sql'

1
answer

LEFT JOIN with WHERE in the field of the first table OR field of the second table

SELECT COALESCE(tb2.numero_novo, tb1.numero_original) as numero FROM tb1 LEFT JOIN tb2 ON tb2.id = tb1.id WHERE tb1.numero_original = <PARAM> OR tb2.numero_novo = <PARAM> The above query generates a full table scan. How to optimiz...
asked by 27.05.2015 / 19:56
0
answers

Problem with aggregate function, using CreateQuery from Hibernate

In a Packaging, a fk Packaging refers to the 'parent', the larger packaging. EX: let's say that inside a package B fit 10 packages A. A packing record A will have in your package the packing B in which it will be inserted. There is a query...
asked by 30.07.2015 / 21:42
0
answers

How do I get the value of an id that is incremental and use it as a foreign key without using set / get? [closed]

I have a primary key and needed to use it in another table as FK, how do I insert into the database in a way that does not need to use the set or get modifiers?     
asked by 31.07.2015 / 19:40
2
answers

Error group by Oracle

When I try to do this group by in oracle it returns me message saying that this is not an expression group by SELECT produto.cd_produto, produto.ds_produto, est_pro.cd_estoque, estoque.ds_estoque, fornecedor.cd_fornecedor, forneced...
asked by 22.05.2015 / 17:06
0
answers

SQL Server - Doubt procedure and relationship between tables

I have a procedure in my BD in which it records material in the database, so far, but in the registration procedure I need to update another table assigning the amount of material to a column x, y depending on the type of material, I saved and e...
asked by 23.05.2015 / 03:36
1
answer

Use "SUM" in access + vb.net

I have a small problem in the Access query, where I have the following code: Dim cn As New OleDb.OleDbConnection Dim cmd As New OleDb.OleDbCommand Dim Da As New OleDb.OleDbDataAdapter Dim Dt As New DataTable Dim dtinicio As St...
asked by 01.07.2015 / 21:17
0
answers

Vertabelo - Warning: Reference Name seems to be invalid

I'm using the vertabelo because I need to share my program with others, however when I brought my work to him. It appears the following warnings, does anyone know what it is? link: link The problem is in the comments, the idea is as foll...
asked by 02.06.2015 / 07:14
1
answer

How to remove duplicate lines efficiently?

I'm normalizing a table here and found that there are duplicate rows. The way I chose to clean these lines is through: CREATE TABLE tabela_nova AS ( SELECT DISTINCT * FROM tabela_antiga ); The problem this way is that it is very slo...
asked by 10.06.2015 / 01:56
0
answers

Uploading xlsx Spring MVC and comparing data with SQL [closed]

I'm trying to upload an xlsx file and compare it to my database table, however I'm not getting it, as my file is too large I can not read it with the Apache POI and then compare to the table of SQL. You can at least guide me how to upload the...
asked by 25.06.2015 / 21:59
1
answer

SQL how do I get back the number of negative ranges (date INTERVAL)

dif_dataactivation_fimdegus is a range of the difference between 2 date fields, which I return, for example, -1 day. I would like to know how I can make a count of all records that are negative in this column.     
asked by 11.05.2015 / 16:13