Questions tagged as 'sql'

2
answers

Select items that do not contain a 2nd table

I need to select data from a table only when the codigo of this table is not in a second table. Briefly that would be it. I have the entregaitem table with the following (codigo,codigoentrega,codigoestoque) columns and the...
asked by 23.10.2017 / 15:09
3
answers

Identifying SQL Brothers

I've put this link as an example of where I want to go link I have the student table. Ihavethetablewiththesibsids Myproblemis,IneedtodoaselectinsuchawaythatIcanonlymakeonenameappearatatimeandproduceanIDtolinkthesiblings: WiththisquerySELEC...
asked by 18.08.2017 / 18:54
2
answers

Fill List with return from sql

Good morning How do I populate a list with a return from an sql? What I tried to do for sure will give me an outofrange exception List<string> list = new List<string>(); string query = "select * from pedidos_distribuidos"; st...
asked by 20.07.2018 / 15:20
3
answers

SELECT on a table using NOT EXISTS SQL (SERVER 2012)

I'm trying to make a Select tb1 using Where NOT EXISTS (select* tb2) I'm trying to select the row in tb1 that does not exist in tb2 to INSERT later. However when doing test on select it is not returning the lines that do not exist in t...
asked by 14.06.2017 / 18:45
2
answers

How do I INNER JOIN in this case?

I am a beginner in PostgreSQL and I need to make a INNER JOIN to relate data from two tables. It took me a long time to figure this out from FOREIGN KEY , but I made the right reference in the database. Now, I have a C # application...
asked by 10.06.2017 / 01:04
2
answers

SQL Query with Duplicate Items

I have this situation and I do not know why it happens. When I pass this SQL command the displayed items come duplicated. What do I do to show an item of each without by the DISTICT SELECT T1....
asked by 10.07.2017 / 20:47
1
answer

How to give a SELECT in several databases at the same time?

I have several databases on my server and I need to perform a query to return some information from a table that exists on all of these other databases. How can I make a SELECT on multiple bases at the same time?     
asked by 28.01.2016 / 22:56
2
answers

Performing update on several records for the same ID

Consider the following scenario for controlling information about licenses in a database Products 1 - Solução x 2 - Solução y 3 - Solução z Suppose you have all 3 solutions Licenses table | ID | CLIENTE_ID | PRODUTO_ID | DATA_...
asked by 27.01.2016 / 16:30
1
answer

Total query of data registered in a field

I have a table where a country field is defined. I want to know how I can develop a query that shows me how many records I have for each country. Example:    Brazil: 10 records from the USA: 5 records     
asked by 27.04.2014 / 14:42
3
answers

SQL use variable in column name

I need to use variables to define the column name in my sql query. Gender: SELECT IDLayout, Nome, @collum, TipoProduto FROM ProdutoLayout WHERE (TipoProduto = @tipo) AND (@collum = 1) Since @collum is the...
asked by 27.03.2014 / 14:15