Questions tagged as 'sql'

1
answer

Must declare the scalar variable SQL

Hi, I'm getting this error and I do not understand why? according to me I am already declaring previously @PTI_R This is my current code declare @Iva decimal(5,2) = (.16), @tasaInteres decimal(10,2) , @fechaDispIni date, @sueldoMens...
asked by 25.09.2018 / 17:52
1
answer

Add results of a SUM in SQL Server

I need to add a series of elements that are in fact the result of a sum, I will try to explain myself as best as possible. I have the following query: select distinct cp.descripcion, cp.idSysCPPuestos, em.nombreLargo ,sum(CAST(em.sueldoDi...
asked by 23.10.2018 / 23:28
2
answers

Error PhpMyAdmin the database fails

I am in a strange problem My database in myphpadmin shows me the following error: Try to import the backing of my previous table where (correctly I showed repeated table) but likewise mind caused errors It's very strange since I...
asked by 20.08.2018 / 20:45
3
answers

get the last insert entered sql

I have a database sql server 2012, where I have a table that contains a datetime field, and what I need is to get the last insert that was made, I have the following table and I hope you can help me --------------------------------------------...
asked by 09.12.2016 / 23:00
5
answers

Make a query with LINQ to entities

var query_actualizar = from x in ctx.banner let orden = ctx.banner.Where(y.id_banner == id_banner).First(y=> y.orden) where x.orden > orden select x; foreach (banner ord in query_actualizar) { ord.orden = ord.ord...
asked by 19.12.2016 / 15:27
2
answers

SQL statement to locate if a date is between 2 others

I want to be able to find all the records with value 1 in attendance that are between 2 dates for a user: SELECT * FROM asistencia WHERE id='124' AND asistencia = '1' AND fecha BETWEEN '2018-07-30' AND '2018-08-12' And as an additional fi...
asked by 15.08.2018 / 16:41
1
answer

SQL current time stamp Where you select a specific day from the month before the present

I am looking for a way to compare a data from my table in SQL server to get the list of records from a date SELECT * FROM asistencias where fecha >= (CURRENT_TIMESTAMP-15) (shows the current results of the current date -15 days) my...
asked by 30.07.2018 / 23:30
2
answers

INNER JOIN listed in the Entity Framework

I have these 2 tables Table Products Table Balances I want to list the table in such a way that it shows me all the data of the first table plus the amount according to the id, I did it with this sentence: SELECT A...
asked by 25.08.2018 / 00:26
1
answer

SQL While traversing a table

Friends I'm trying to run a table from SQL but for some reason I do not get the data for each row of my table. Can someone tell me what I'm doing wrong? declare @count int = 0, @countb int = 1 set @count = (select count( * ) from sta...
asked by 22.08.2018 / 22:34
1
answer

Get the percentage in SQL Server

I have two quantities a total value and a value to date and I need to take the percentage, example: ValorTotal = 66215 ValorALaFecha = 5524 Porcentaje = ? At what percentage is the ValueAutumn equal to TotalTotal .     
asked by 27.07.2018 / 23:22