Questions tagged as 'sql'

3
answers

Group By consultation with Order By do not work together

I have the following query: select * from tblreviews WHERE Estado=1 group by Website ORDER BY fchFecha DESC limit 5 In which only the part of the group by works for me but it does not order the result in the most recent date. Tha...
asked by 10.08.2018 / 18:30
1
answer

Join Query in one with JOIN [closed]

I'm trying to merge several SQL statements into one, the problem is that it has a JOIN and I do not know how to rename tables SELECT users.nombre,users.apellido,users.id, COUNT(ligauruguaya_v.primero) AS Primero FROM users LEFT JOIN ligaur...
asked by 24.03.2018 / 18:08
2
answers

Delete n rows of a table

My question is this: How can I delete n rows from a table if they meet the condition x rows in total? Where x> > > > > n. I want to use it because I am going to have a job that runs at a certain time and if every time it is execut...
asked by 27.03.2018 / 13:53
1
answer

Change the 1 of a MAX CASE to an image in php

Let's see if I can explain friends, I have this query that I have managed to execute correctly thanks to you, I am working on postgreSQL and php, and so my table is built to show on the page in php <div id="tabs-8" class='panel'> sel...
asked by 07.03.2018 / 21:13
1
answer

Bring php variable in an xmlhttp function

I am working with html, php, javascript, postgres. I have a form that contains a combo, a button and a panel. The operation of the form basically is: choose a type of animal, press the filter button and the panel displays a table with the...
asked by 13.03.2018 / 19:09
2
answers

Consult 3 tables and the result is by id the largest in 'Sql server'

I have 3 tables and I have the following query: select S.ID, C.IDSENSOR, C.ID, CF.IDCANAL, MAX(CF.ENTRY_ID) as entry, cf.estado from Sensor as S join Canal as C on S.Id = C.IdSensor join CanalFeed as CF on C.Id = CF.IdCanal where S...
asked by 14.03.2018 / 02:03
1
answer

Problem with for (cursor) and if linked Oracle PL / SQL procedure

What I intend is to create a procedure that updates the sale price of a piece whose price is passed by parameter, this will be done only if the new price is greater than the existing one in the database. For now I want to do it without exception...
asked by 12.05.2018 / 16:58
0
answers

How to make a table that is updated at the same time as an INSERT INTO is made to the base?

I am developing a fairly simple tool, it is for a Call Center works in the following way. It is basically a "Ranking" of best sellers, by means of a form the sales are entered into a database and on the page informe.php this table of the quer...
asked by 22.03.2018 / 19:08
1
answer

Database Model

I have the following database model in 4 tables. The first, "person", with the following elements: id, name, surname, ID, email. The second, called "user", with id, id_person, id_department, id_sede, name, password, type. The third, called "head...
asked by 20.03.2018 / 16:06
2
answers

How to delete an Id and restructure the database

I have the following problem and I do not know if there is a function in php to do this or in what way I can fix it. I have a database in which I will search for records that match a search criteria, when I receive it I will have something...
asked by 19.02.2018 / 06:42