Questions tagged as 'sql'

4
answers

What is the best way to make a current contract selection and an employee's previous contract in the same row?

Hi, I'm scheduling queries in Oracle 11g and PostgreSQL 9.4, and I have been asked to perform a query whose output is shown in the following image. Employee_ID belongs to the employee table; Current_Contract_ID and Previous_Contract_Id...
asked by 08.11.2016 / 18:21
2
answers

Group records in ranges of 15 in 15 in SQL Server 2014

I have the following table: I need a script that returns the data in the following way from FECHA_INGRESO and GETDATE() : I can get the number of records, but I have no idea how to get them grouped from 15 to 15. I...
asked by 27.10.2016 / 20:25
2
answers

How to filter repeated series in SQL

I'm using SQL 2008 to query using inner join: SELECT t2.intencion_id,t2.numpago,t3.orden,t2.importe ,SUM([importeaplicado]) AS importeaplicado ,t3.intfinanciamiento_interes ,t1.[estatus] FROM [APLICACIONES] as t1 inner join movcargos as...
asked by 01.11.2016 / 21:05
1
answer

SQL query to see user with more confirmed friend requests

In a database exercise I get a DB with which I must take 2 tables TBL_AMIGOS and TBL_ESTATUS_SOLICITUDES to make a query to know the user with the largest number of confirmed requests. I've tried with HAVING and COUNT...
asked by 16.10.2016 / 09:13
5
answers

DATETIME check for hours

I need to do a search by hours, that is to say that I see a specific field filtered by X hour     
asked by 14.10.2016 / 12:27
5
answers

sql problems for booking inquiries

I am creating a small web booking application for boats, where the client can check which ones are available and, based on this information, reserve one from the list. My PHP query script is this (also here ): <?php error_reporting(E_AL...
asked by 13.10.2016 / 12:52
1
answer

Error Handling in Sql

I have a stored procedure in which I add a query to a variable (by topic of dynamic tables). The problem is that when you enter a date and the table does not exist, the PRC falls. That's why I need to handle mistakes and I can not do it and I wa...
asked by 24.03.2017 / 13:15
1
answer

maximum value + 1 with case in sqlserver

How can I make a sql query where I select the maximum value of the folio column plus one, taking into account that the table may be empty the first time it is used, I have the following query but I think it is missing more. the query to get t...
asked by 02.08.2016 / 19:47
1
answer

Does not register SQL form data with Visual Studio 2013 [closed]

I have a database SQL server 2008 and VS 2013. I have tried to register information in a database and everything works correctly. At one point I changed the connection to another base in the same ip and now no data is recorded. W...
asked by 19.01.2016 / 15:55
1
answer

mysql query does not work

The query does not work for me. What am I doing wrong? update users set hasCredit = 1 where users.id = (select users.id from users inner join creditRequest on (users.id = creditRequest.user_id))     
asked by 02.09.2016 / 17:42