Questions tagged as 'sql-select'

1
answer

SQL query using order by filtering through the records [closed]

I have the table: | cod | hora | produto | Amostra | Min | Max | |-----|-------|---------|---------|-----|-----| | 1 | 08:00 | 96722 | 1 | 100 | 200 | | 2 | 08:23 | 96721 | 1 | 90 | 90 | | 3 | 08:50 | 96722 | 2...
asked by 06.09.2016 / 16:08
1
answer

Pass data by link - php application

I am not able to do something, I am a beginner in php and web programming and I am trying to make a page to receive the ID of any user through a click on the link: 'while($linha = mysqli_fetch_array($result) ) {...
asked by 13.03.2016 / 13:06
0
answers

Format JOIN result object

[PROFESSORES] id | nome | 1 | Gilson | [CURSOS] id | nome | professor_id 1 | Photoshop | 1 2 | AutoCad | 1 I would like the result of my SELECT to come in the format: (Not necessarily or exactly the same, I just want to gro...
asked by 09.11.2015 / 18:12
1
answer

SQL Query Optimization

I've set up a series of SQL but I'm having difficulty generating something that stresses less the server, I ask for help from you. Follow SQL: SELECT '2015-06-10 00:00:00' AS 'Hora', COUNT(id_contato) AS 'Total' FROM contato WHERE data_hora...
asked by 10.06.2015 / 22:05
2
answers

Help with date when ordering

I have a field in the table that is set to dtConcat2 timestamp CURRENT_TIMESTAMP and in insert it takes the date of the server and writes in that field, the problem when I print the invoice the date field goes like this: Order...
asked by 03.12.2017 / 13:40
4
answers

MAX with LIMIT does not give correct result

Imagine the following lines in my MySQL database: I want a query that displays the name and age of the person who is the oldest in the table, so I did this query : SELECT nome, MAX(idade) from pessoas; But it does not return th...
asked by 22.11.2018 / 16:26
2
answers

View with double SELECT from the same table

I need to mount a VIEW with three fields, but one depends on the other to be calculated (two of them are from the same table in different lines I need to "link" them), how do I add those fields in one place? The select's are as follows: SELECT...
asked by 23.04.2018 / 18:08
1
answer

Why is my WHERE statement in MySQL not working?

I have the following SELECT, and in the WHERE clauses the amount of credit was only shown if > = 2, but even putting the condition, shows me everything. (fornecedor_credito.qtd_credito >= '2') AND (cadastra_oferta.qtd_estoque >= '2')...
asked by 22.07.2017 / 20:10
2
answers

How to perform more than one select for just two fields from another table

I am not able to select more than one table to display only ID and name data (t_address table), I am performing the SELECT of the entire t_cad table with WHERE in the contract number passed via SELECT from another page: common fields of tables="...
asked by 10.10.2014 / 21:14
2
answers

How to select the most used foreign key?

I would like to make a SELECT where you would select the foreign key ( idTema ) most used Example: That example above would be 1 How would that SELECT ?     
asked by 14.06.2018 / 22:20