Questions tagged as 'sql'

1
answer

Can not perform an aggregate function on an expression containing an aggregate or a subquery [duplicate]

I have this query and it does not allow me to use an aggregation function within another aggregation function and the fact is that I want the fields not to be repeated and I have already tried with distinct and nothing. this is the error:...
asked by 21.08.2018 / 18:11
1
answer

How to call the id of my SQL database and show it in a query with PHP?

I have a form, where users enter personal data. I did an if, so that the CURP was not repeated, if the curp is repeated it sends an alert telling them that it is repeated and it returns them to the form, in that I do not have problem it seems to...
asked by 31.08.2018 / 07:32
1
answer

Insert data into a table with the same primary key

Good, I'm doing a screen where I store the payments of some clients, at the moment of inserting, I must put the same client code. I must use the same client id which is the primary key which gave me an error. I could fix it by doing a procedure...
asked by 15.08.2017 / 15:08
1
answer

Select a record randomly in MySQL with PHP

How can I randomly select a record in a database that meets a condition (that is, it is also possible to use the WHILE). mysql_query("SELECT * FROM mitabla WHERE cat=4 ORDER BY RAND() LIMIT 1"); That example would be fine?     
asked by 14.11.2018 / 16:53
1
answer

SQL query help [closed]

Hi, could you tell me if this exercise is done with a subquery? "Indicate the DNI, first and last name of the owner who has the Casa Particular with more m2." Thank you.     
asked by 04.01.2018 / 18:06
0
answers

Error converting date to SQL statement

I get this error    Mens. 241, Level 16, State 1, Line 1 Conversion failed when   converting date and / or time from character string. When executing the following query: Select TOP 1 T2.Text12 AS DPI, T2.Name AS NAME,...
asked by 31.12.2018 / 09:41
1
answer

Error PHP line quotes [closed]

I have an error in the quotes of this sentence of MySQL in PHP, since the LIMIT does not take it as such, I hope your help. $sqlP = 'SELECT * FROM coleccionPublicaciones WHERE id_publicacion='.$row["id_publicacion"].' LIMIT 1';     
asked by 03.07.2018 / 13:03
1
answer

SQL date show in php ago when it was the record

I work on a table of reminders and I would like to be able to show how much the record was created in my table My table tasks : id idusuario usuario titulo Contenido fecha Estado 1 1 juan titulo1 aaa qq 17-08-1...
asked by 27.08.2018 / 18:05
4
answers

Show records that are repeated every month

I have been working on a table in a database, which I need to show the clients that make at least one purchase every month. But until now I could not. I leave the table and the query as it should appear, so they can help me. PURCHASES tabl...
asked by 23.10.2018 / 18:35
5
answers

MySQL to start with SQL?

I'm just starting with the SQL language, I've run simple code in openoffice base but now I need to learn more, I do not understand what I should download from the page link to be able to practice, what is the correct download option?     
asked by 07.06.2016 / 04:10