Questions tagged as 'sql'

1
answer

Ignore certain value with AVG

I would like the calculation AVG to ignore the values above 100000 (10 seconds), with the following query: user_id, COUNT(*) as total, AVG('exec_time') as tempoMedio, SUM(CASE WHEN 'success' = 1 THEN 1 ELSE 0 END) inTime, SUM(CAS...
asked by 25.10.2017 / 19:31
1
answer

Find a string in a string

I have this String in oracle: 'Linked Order with Sale: 4575987/10' and would like to return only the order number in this case 4575987/10. So far the maximum I've achieved is by passing a fixed value, but you are going to invoke a fixed number I...
asked by 01.11.2017 / 13:11
1
answer

Permission to change only one table column in PostgreSQL

Good evening! I'm using PostgreSQL and it has a table called Products. When the user visits a product through the site I give an UPDATE on that table to increment the visits column. The problem is that the database user can only have read...
asked by 27.10.2017 / 04:57
2
answers

Place records on one line only

Problem: The user does several logins and several logouts, he wanted to log in and log out on the same line next to the user name, with the login date and the logout date, on the same line. All records in one line only.     
asked by 26.10.2017 / 20:13
0
answers

Subquery at Banco Informix

I have a query that searches sales for a period: SELECT cxpdvend.filial, cxpdvend.dtpedido, cxpdvend.pedvenda, ciendere.nro_endere, cipessoa.nomepessoa, ciendere.celular, cxpdvend.codagente,...
asked by 19.10.2017 / 11:14
1
answer

C # join 3 tables using Linq?

I'm getting to learn C # and I'm picking up on some points. I have 3 Tables. Follow the models public class Tag { [Key] public int ID_Tag { get; set; } [Required(ErrorMessage = "Preencha o Nome")] [MaxLength(100)] pu...
asked by 08.11.2017 / 04:46
1
answer

Delete constraint after taking its name

I'm running the following query to get the name of 2 constraints : select TC.Constraint_Name from information_schema.table_constraints TC inner join information_schema.constraint_column_usage CC on TC.Constraint_Name = CC.Constrai...
asked by 16.10.2017 / 19:45
1
answer

Function inside sql server

I'm trying to make a function inside the sql server, however, I can not use it because an error appears saying that the result is more than one line (Error Code: 1172 Result consisted of more than one row) I can solve this. 'CREATE FUNCTION 'r...
asked by 02.11.2017 / 15:43
1
answer

Problem connecting to Firebird database

Personally, I'm having a project to do a report that does a search on a firebird bank and I'm with the .fb file ready to create the bank. However, in connection with dbschema it gives me this driver error. I researched the internet and cou...
asked by 04.10.2017 / 05:33
1
answer

Transform Inner Join Join to Join Laravel

I am updating a system that is developed in pure PHP and I am putting it in Laravel, however, I had never done more than one join and with "AND" parameters so I would like to be helped, how can I put this SELECT in the controller Laravel? <...
asked by 13.10.2017 / 12:00