Questions tagged as 'sql'

1
answer

Query to return text from the middle of a field

I have a query that returns some class names / disciplines , however I wanted it to bring me just the names of the disciplines . Below is the result of the query with the [class] [discipline_name] [branch]: ADM N1A OFFICIAL COMMUNICATION...
asked by 09.02.2018 / 22:35
1
answer

How to handle Null fields in PostgreSQL [duplicate]

Hello, I need to know how best to use COALESCE to handle the null fields in my table. My problem is the following, I'm simulating 6 Stores and their respective cards, let's suppose that one or more stores did not sell product in the Amex card,...
asked by 07.02.2018 / 21:42
2
answers

Add values of different selects

Good morning To everyone, I have two select, I'm displaying next to each other, I need to add the value of a select with that of the other .. is it possible? the two select are separate tables, I'm displaying one value next to the other, but I n...
asked by 09.02.2018 / 11:16
1
answer

Add Count () in mysql

I have this query that returns me the number of dates equal: SELECT 'Data', COUNT('Data') AS 'Quantidade' FROM sua_tabela GROUP BY 'Data'; | Data | | 2016-06-09 | | 2016-06-09 | | 2016-06-09 | | 2016-06-08 | | 2016-06-08 |...
asked by 09.02.2018 / 13:12
1
answer

Select all items with the same ID in the same table

Very well, I'll try to be as clear as possible. I have the stock table where you will have several products there - > ProductId and its Quantity. In the same table the productId can be repeated with a different quantity, in my current code I...
asked by 17.02.2018 / 00:52
1
answer

Add fields to a select

How do you put the driver and the idle in my SELECT: CREATE TABLE Obra_Assunto ( idassunto INTEGER NOT NULL, idobra INTEGER NOT NULL, PRIMARY KEY (idassunto, idobra), FOREIGN KEY (idobra)REFERENC...
asked by 06.06.2018 / 14:42
1
answer

Add return from select

I have the following query : SELECT (case when day(sysdate()) < 10 and meses.mes = month(sysdate()) then 0 else CAST(SUM(CASE WHEN s2.name LIKE '%Servidores' THEN ( coalesce(ta.time_unit,0) * 1.5)/ 60 ELSE coalesce(ta.time_unit,0)/60...
asked by 06.06.2018 / 15:52
1
answer

how to add values from different records?

I'm trying to add the value of id 1 and the value2 of id 2 which in this case would equal 220, how do I do this query ? ID VALOR VALOR2 ---------- ---------- ---------- 1 110 100 2 1...
asked by 08.04.2018 / 17:57
2
answers

How to run a subquery in LINQ C #?

How to run a subquery in LINQ C #? SELECT ap.ID FROM Aplicativo AP WHERE AP.Tipo IN (2,6) AND AP.ID NOT IN (SELECT filhoID FROM relacoesobjeto WHERE filhoclasse = 555)     
asked by 10.04.2018 / 19:11
1
answer

select with multiple BETWEENs

Good people, I need a help, I'm doing a filter and to do the select I did so: $molcomp_query="SELECT * FROM stock_comp WHERE (diametroaco BETWEEN '$d1' and '$d2') AND (comprimentototal BETWEEN '$comp1' AND '$comp2') AND (diametroexte...
asked by 10.05.2018 / 10:35