Questions tagged as 'sql'

3
answers

Check last record of an sql table

Good luck, next ... I'm trying to get the last record from a table with an id SELECT * FROM tabela WHERE id = ? ORDER BY id DESC LIMIT 1 Except that he is not returning the last record, he is traversing the whole table behind a record, can...
asked by 09.01.2018 / 22:31
2
answers

Insert Select Sql Server

Connection and Historico_ligacao I have a script that copies all data from table Ligacao to Historico_ligacao . When comparing the data between the tebalas, the historico_ligacao table is ordered differently th...
asked by 04.12.2017 / 19:52
1
answer

Join in sql that returns all

I have two tables, the one of episodes and of episodes seen, I need to make a query that will join the two by the id of the episode, but I do not want the episodes that are not in the second table do not come in the result, an example: Thisi...
asked by 24.10.2017 / 19:21
1
answer

Relationship between tables of same values in columns

I want to do a sql query that lists two columns of two different tables, which store the same types of values, but one has some that the other does not contain, eg: Table 1 has the column code and Table 2 has the column code I w...
asked by 20.11.2017 / 00:09
1
answer

RDS SQL Server AWS - Doubt about changing instance class BD

I need to change the class of the database instance, as I use the "micro" and need to change to an instance with larger resources. My question is if I change, do I lose my current database? This is an MS SQL Server database in production, so I c...
asked by 21.11.2017 / 18:35
3
answers

How do I meet the first Tuesday of a month ?! (SQL)

I am performing the following exercise: Thetablesareasfollows: I already have the following code: SELECT NOME FROM CLIENTES C,VENDAS V, LIVROS L WHERE V.CODIGO_CLIENTE=C.CODIGO_CLIENTE AND L.CODIGO_LIVRO=V.CODIGO_LIVRO AND TO_NUMBER(...
asked by 14.12.2017 / 16:59
1
answer

Delete result with JS and PHP

I have a script in js to delete sql results with PHP and JS ... LINK <a href="javascript:;" onClick="deletar(<?php echo $exibe['matricula']; ?>);"> JS function deletar(matricula) { if (confirm("Tem certeza que deseja ap...
asked by 15.12.2017 / 17:29
2
answers

Query to list number of occurrences

I'm trying to list the amount of CATEGORIES that each PERSON has but only want to return if the PERSON has more than one CATEGORY. My query is like this and returns nothing. And I know there are cases to show. SELECT COUNT(*), PESSOA_FK,CATEGO...
asked by 02.10.2017 / 14:44
1
answer

Cross-Query mySql

I'm not really sure how to express myself more, what I need is how I can do a normal and inverted query. Below I have two fields one source and one destination. I need to make a $origem = $_post["origem"]; $destino = $_post["dest...
asked by 28.09.2017 / 20:13
1
answer

Join the results of two SQL commands in H2

I created the following Query : SELECT s FROM SuprimentosPedidos s WHERE s.codigoModeloImpressora = :codigoModeloImpressora AND s.codigoEmpresa = :codigoEmpresa and s.prioridadeSaida = 1 ORDER BY s.prioridadeSaida, s.suprimento ASC u...
asked by 09.10.2017 / 13:31