Questions tagged as 'sql-select'

3
answers

No select error using mysqli_query

I've done a php to list the rooms, but I'm having difficulty listing them, if anyone can help me, I would appreciate it. <?php $link = mysqli_connect("localhost","root","","hotel"); $result = mysqli_query("SELECT descricao FROM quartos WHER...
asked by 08.06.2015 / 21:53
1
answer

Join two IFs or more

I need to join some if 's and I'm having trouble, I have already tried using union , but to no avail. The query I'm running is: IF (select count(Estado) FROM tbl_1 where Estado != 'WIP' AND Estado !='on hold') > 0...
asked by 20.03.2018 / 16:40
1
answer

Update the rest of a table from the data contained in a row

The following figure explains well what I want to try (and what I tried to do but it did not work): That is, I need to update some rows of a table with the same data contained in a row (specifically the columns bankId, proj_day and liq_...
asked by 16.01.2018 / 01:36
0
answers

SQL Server Error When converting VarChar to Integer type [closed]

FOLLOW THE ERROR Msg 245, Level 16, State 1, Line 2 Conversion failed when converting the varchar value '280-64460-2' to data type int. SQL DONE USE TOXICOLOGICO SELECT NomeUnidadeColeta, NomeUnidadeColetaAlterar, Procedimento FROM dbo.Z...
asked by 02.10.2017 / 20:41
3
answers

No select error using mysqli_query

I've done a php to list the rooms, but I'm having difficulty listing them, if anyone can help me, I would appreciate it. <?php $link = mysqli_connect("localhost","root","","hotel"); $result = mysqli_query("SELECT descricao FROM quartos WHER...
asked by 08.06.2015 / 21:53
8
answers

Why is "SELECT * FROM table" bad?

It is often said that getting all the columns of a table through the SELECT * FROM tabela command is bad practice. Any recommendations without explanation are not helpful. So ... If it is bad practice, there must be a way to use it pro...
asked by 16.06.2014 / 21:26
1
answer

How to do a Ray calculation in SQL, using MySQL, with two conditions?

Hello, I already do a ray calculation in SQL, using MySQL and PHP, which takes the location of the device (latitude and longitude) and filters the radius according to the location of the device. It's like this (excerpt): (6371 * acos(...
asked by 06.05.2017 / 19:29
1
answer

Sub-Select with MAX / SUM / INNER JOIN?

I need to make a SUM within MAX to return the highest product billing within a summary. I was able to do this: SELECT MAX(Faturamento) MAX_Faturamento FROM (SELECT SUM(P.preco * I.qtde) Faturamento FROM produto P IN...
asked by 01.05.2017 / 17:01
1
answer

Search last record of a different group

I'm developing a small vaccine control system and I'm having a hard time performing a select. I have a record of dogs, another of types of vaccines and a third of vaccine per dog, where I group the dog's id, type id of the vaccine (v10, antir...
asked by 10.03.2017 / 17:12
0
answers

MySqlDataAdapter Fill giving error

When using database connection in C #, I saw many ways to do it. I can make insertion of data in the database very quiet, but the selection of data is leaving me with white hair. Below the code and I will explain the error soon. public void...
asked by 06.01.2017 / 14:02