Questions tagged as 'sql'

2
answers

Problem to mount query

I can not mount a query, the logic is: Select produtos with categorias different, being the products with more points, thus I will have a product of more points of category X, another of category Y. I tried to use DISTINCT...
asked by 10.06.2015 / 19:53
1
answer

Prefixes in SQL Statement

In SQL Server it only accepts 4 prefixes in sentences, eg Select * from pmv.banco.dbo.tabela . In this case, I'm using a client linked server. However, when I refer to some table field, where I would get a prefix ( pmv.banco.dbo.tabe...
asked by 16.06.2015 / 18:16
1
answer

Error getting data in SQL

I have this code: SELECT Colaborador.IdColaborador, Colaborador.Numero, Colaborador.Nome, Colaborador.[Centro de Custo], Colaborador.Usuario, Colaborador.Responsavel, Colaborador_1.Nome FROM Colaborador, Colaborador AS Colaborador_1 WHERE (((C...
asked by 07.04.2016 / 23:55
1
answer

How to remove the UNIQUE KEY attribute from a column in MySQL?

I created a table in MySQl that uses a column named loja_num with the unique key attribute UNIQUE KEY loja_num (loja_num, But now, I'd like to remove this attribute from this column. I've done some research without success. Does an...
asked by 18.09.2016 / 02:46
3
answers

Compare day and month of a date?

In MySQL I have saved the date of birth of a person, I need to set up a query to return the birthdays of the week, those that make today's birthday until today + 7 days. p> I'm trying like this: //Metodo da tela de listagem public fu...
asked by 28.10.2016 / 16:22
1
answer

How to work with lock in SQL records?

I'm studying best practice to work with lock of records. What I mean is, I have several tables that can be accessed by multiple users simultaneously, but if one tries to edit the registry, for others this registry should be locked for...
asked by 26.09.2016 / 19:44
1
answer

Dynamic Query Sql Server

Gentlemen, I have the following problem: I have to set up a query that works with multiple views, for example, one of products or one of people. I'm doing some tests with this code: declare @coluna nvarchar(max) declare @variavel nvarchar(m...
asked by 24.06.2016 / 22:11
3
answers

Discovering SQL from a ResultSet

I have a java ResultSet object that does not know the SQL / Parameters that generated it. I would like to know how do I get the SQL used to create it? would have something like: rs.getStm.getSql ?     
asked by 21.07.2015 / 22:11
1
answer

Display subquery result and use it for calculation

I need to display a result of a subquery and use the same result to perform a calculation, is it possible to play it to a variable in MS SQL 2008 or something along those lines? example: SELECT @test = (SELECT COUNT(*) FROM [tableTest] WHE...
asked by 05.01.2015 / 17:24
1
answer

I can not perform a Select

I have a question about how I should mount SELECT for a given function. The scenario is as follows: I have 4 tables: Tab_Pessoa - Tab_Cliente - Tab_Autorizado - Tab_Cliente_Autorizado . So the Tab_Pessoa is related to...
asked by 12.01.2015 / 14:15