Questions tagged as 'sql'

1
answer

Sort menu by ID

I have a manageable menu, where you need to organize the items by ID. Each menu item corresponds to an ID. $rsm = exesql('SELECT * FROM produtos_categorias WHERE id_pai = 0 AND ativo = "S" ORDER BY categoria ASC') This is the organization I...
asked by 01.06.2018 / 04:07
0
answers

Connect SQL SERVER database to external server with application in Notebook

I have a SQL SERVER database hosted on Locaweb. However to develop I need to connect this bank to the Site that is locally in my notebook. The Site System is in ASP CLASSIC. I made the ODBC connection on the machine and changed the connect...
asked by 30.05.2018 / 20:28
0
answers

SQL with SELECT and SUBSELECT to set up a chat

Hello everyone, I'm building a SQL Server database, and I'm using SQL Server 2005 to create a user-defined chat. I have a list of all the active conversations, but I have a problem, my SQL is bringing the last message according to id of the Clie...
asked by 25.05.2018 / 17:51
0
answers

Select VIEW returns zero

I made a simple login screen in the local environment (xampp) and it works perfectly, without any error, however, when uploading to my web server (both run PHP 7.1), it does not work, it only generates the error message login and password. After...
asked by 25.05.2018 / 12:52
1
answer

Display a record by quantity and the most repeated value of a column

Hello, I have the following problem: I need to display the locations, the number of submissions for each one (that is, how many times the name of the locality appears in the column) and the most common disease in each locality , the name of the d...
asked by 24.05.2018 / 16:18
2
answers

Select data from three SQL tables

I'm trying to merge data from three tables using this sql: SELECT cod_nota, cupom, valor_contrato, valor_cadastro, data_emissao FROM cupons_nota, vendas, notas_fiscais WHERE cupons_nota.cupom = vendas.numero_nf AND notas_fiscais.cod_cliente='0...
asked by 24.05.2018 / 15:20
1
answer

How do I add values from different tables?

I have two tables (Costs and Revenue) where I need to make a sum of the field that contains values of each of them, after making a calculation (Balance) showing the balance of Revenue - Costs = Balance. Follow the information in the two tab...
asked by 24.05.2018 / 15:57
1
answer

Subselect OrderBy first line

I'm doing the select below but in the last subselect (mileage) I'm having problems with the ORDER BY error "ORA-00907: missing right parenthesis", if I remove ORDER BY it works. SELECT /* DATE OF THE ROUTE */ {GPS}.[DateTi...
asked by 24.05.2018 / 11:16
3
answers

How to do an operation on a Trigger? MYSQL

CREATE TRIGGER aumentarsalario AFTER INSERT ON empregados FOR EACH ROW BEGIN UPDATE EMPREGADOS SET SALARIO = NEW.SALARIO * (NEW.SALARIO*(10/100)) WHERE NEW.SALARIO < 900; END IF END How do I put another 10% on a product? at which point...
asked by 17.05.2018 / 21:32
2
answers

Bring the second and third line of a query

Oracle-SQL I have a table that records the point records that each employee does. The table gives the following information: (TABELA QUE ESTOU FAZENDO A CONSULTA) Contrato | Data | Hora 1 | 10/05/2018 | 07:00 1 | 10/...
asked by 25.05.2018 / 00:13