Questions tagged as 'sql'

2
answers

Return vehicles that have all parts in a given table

I have the following question, in my database I have the following tables: | veiculo | | idVeiculo | placa | | peca | | idPeca | nomePeca | | relVeiPec | | idVeiculo | idPeca | | pecaObrig | | idPeca |...
asked by 27.05.2016 / 20:54
1
answer

SQL Like without considering the order of the parameters

I need to make a comparison between two tables to find out if the address of table A is present in the address of table B. Example: Table A has a record with the ENDERECO field with the value "STREET FULANO DE TAL 67 401" and in table B, the...
asked by 18.10.2016 / 23:01
1
answer

Select to bring specific record of an id

I would like to know how to get a specific record of a fk, I have the hosting table and the consumption (with codHospedagem ). When I select some hosting, I click on the consumption button of my consumption screen. I need to bring i...
asked by 19.05.2016 / 23:27
2
answers

Query product mix oracle

I made an indicator here in the company where you ready product information, quantity sold, average value, etc. This in a period of time. Now I need the following information: What is the product that most often appeared in the same sales...
asked by 19.05.2016 / 18:31
1
answer

Problem with IN clause

I need to use the IN clause in a situation where the in part is a string. Example: SELECT * FROM BLABLABLA WHERE 4 IN ('6,5,4') This causes me this error: Conversion failed when converting the varchar value '6,5,4' to data type int....
asked by 23.05.2016 / 16:04
2
answers

Inform a date, and pick up the interval of the week of the month of that date (from Sunday to Saturday)

I need a SQL command (SQLite for android) that returns the one-week interval (from Sunday to Saturday) of an informed date. For example: I enter the date '05 -05-2016 ', hence the command in sql would return the range '01 -05-2016' and '07 -05-2...
asked by 05.05.2016 / 17:24
2
answers

How to do a select in date format?

How do I perform a select using dates in SQL server 2008 ? When I do a search with this select: select * from NOME_TABELA where DATA_FISCAL between '2016-05-01' and '2016-05-11' The result is 12 records including one record has the da...
asked by 13.05.2016 / 17:04
1
answer

Query with date in variable in MySQL returning empty

I need to make a query in MySQL setting 3 variables, when I know in the case of integer number of the right one, more when I include data ta returning empty. Follow my query , what could be doing wrong? SET @tipo = 47; SET @dataini = 201...
asked by 04.05.2016 / 21:35
3
answers

List records that are in a table and those that are not in the same table

I have a dots table and a users table. In points, I have an ID that references the user of the users table. What I need to do is to return all users who hit the point along with those who did not hit the point. So I can see who hit and who did n...
asked by 09.05.2016 / 14:34
2
answers

How to make change in database without having a clear primary key? [closed]

I need a method to do data change in a SQL Server table. According to my client, all the table data can be changed. By having this possibility, I am without a fixed and unique reference for the bank to know which data will be changed. UPD...
asked by 23.03.2016 / 15:38