Questions tagged as 'sql'

1
answer

HTML & PHP - unread HTML code

I have following code on the part of PHP does not present any error, the page appears blank and does not show the HTML code. <?php include("config.php"); if($_GET['key'] && $_GET['reset']) { $email=password_hash($_GET['key'],PASSW...
asked by 15.05.2017 / 00:10
3
answers

SELECT filtering the first results

I have the HIGHLIGHT field (yes) (no) I would like to display the results by removing the first 4 results HIGHLIGHT (yes) and display the rest of the records both the (yes) from the 4th and the not I tried to use LIMIT OFFSET more d...
asked by 02.03.2015 / 21:53
2
answers

How to sum a field of a certain ID with multiple records?

Thestorygoeslikethis:apoliticiancanbevotedonforseveral%of%,sothereasonforthesame%candidate%containmultiplerecordswithinthetable.ThezonasbeingID,hehaving6recordsinthedatabasereferringtothe6differentzoneshereceivedvotes.HowtosetupaID_CANDIDATOthat...
asked by 06.03.2015 / 21:24
1
answer

How to select only the days of the week?

How do I get weekdays, excluding weekends, using SQL? I need to notify the customer about some debt, and if it is Friday I can not charge it because it will start the weekend, it will take Saturday and Sunday to pay so it will only be notifie...
asked by 03.11.2014 / 18:29
3
answers

How to return the last ID of a query

I'm working with an Oracle database I have two tables: Student Table: IDALUNO IDMATRICULA FASE Test Table: IDTESTE IDALUNO IDMATRICULA TESTE STATUS I still have a view that gives me the information of the students View St...
asked by 27.01.2015 / 18:44
2
answers

Order for quantities of days missing to win

I have this script in my code: $sql = "SELECT * FROM os WHERE status2 <> 'Fechado' ORDER BY XXXXXXX "; $resultado = mysql_query($sql) or die ("Erro na consulta"); while ($linha = mysql_fetch_assoc($resultado)) { $vencimento = $linha["...
asked by 19.01.2015 / 23:53
2
answers

Difference of hours query sql server

I have the following data: 2016-10-13 09:04:00.000 1 2016-10-13 20:33:00.000 4 2016-10-14 09:10:00.000 1 2016-10-14 21:04:00.000 4 2016-10-17 09:04:00.000 1 2016-10-17 19:50:00.000 4 How to tell the difference between hours between 4...
asked by 18.10.2016 / 16:38
2
answers

Insert foreign keys

I have two tables and when I try to use a key of the 1st table in 2nd the value appears NULL and it should appear the values that appear in Aquario CREATE TABLE Aquario( ANome varchar(64) PRIMARY KEY, Localizacao varchar(8), Capaci...
asked by 04.11.2016 / 12:47
2
answers

Subselect in Oracle database

I am trying to compile a query and within one of my joins it is necessary to make a subselect to ensure the integrity of the query as the example below: select t01.teste from teste t01 left join tes_teste_2 t02...
asked by 17.11.2015 / 21:22
2
answers

How do I sum the difference of 2 intervals in Postgresql?

I need to make the sum of all the differences of the intervals that fulfill the condition of the where. There is only one, however, if there is no end_date on this line, I need to pick up the current schedule and do the calculation with the curr...
asked by 21.08.2014 / 20:19