Questions tagged as 'query'

2
answers

Comparing prepare () vs query () with mysqli

I made a query in the database, with query() using mysqli and num_rows to return the number of lines, see the code: $consulta = $mysqli -> query("SELECT * FROM tabela WHERE Pedido = '$pedido' AND Email = '$email' "); $linhas =...
asked by 19.01.2015 / 15:10
3
answers

How to do a select within a condition?

How can I do to create a script in SQL where a SELECT runs, and according to the result of a column of this first, a certain condition of another table? example: select * from tabela as t SE t.saldo = 0 entao WHERE t2.outracondicao =...
asked by 14.09.2018 / 13:19
3
answers

How many days are left for a date [duplicate]

Does anyone have a query in sql server that returns how many days are missing for a date? I have the employee's date of admission, I need to know, how many days to complete 45 days, and how many days to complete 90 days.     
asked by 21.07.2017 / 19:53
2
answers

What is a "0" field in SQL SELECT?

I did not understand the use of 0 in this code: SELECT substring ... 0 AS PARCELADO, ... FROM ... What does it do?     
asked by 08.12.2014 / 17:48
3
answers

How to deal with multiple queries?

I have a question regarding good programming practice. How to handle multiple queries on a single page in PHP. For example, the code: $qr = "SELECT historico.*, funcionarios.nome FROM historico INNER JOIN funcionarios ON (historico.funcion...
asked by 20.05.2014 / 04:59
2
answers

Search system - Select within another

Hello, I'm doing a search engine, but I'm kind of a layperson about Querys. The method that I thought to refine the search, which in the case would be a simple search between two fields of a table with several products, was to be eliminated thro...
asked by 08.05.2014 / 22:07
1
answer

What is the best way to set up a query?

What is the best way to set up a query in C #? Is it advisable to use concatenation with the + operator? For example: query += " WHERE nome LIKE '%" + nome + "%'"; Here is a% w of% that I set as an example to illustrate the situat...
asked by 18.12.2015 / 00:24
3
answers

Query in a SQL string in C #

I am doing a query in the database via string sql.append , in the method call I have two parameters, two strings these receive a textbox typed by the user and do the verification in the database. How do I concatenate correctly? Be...
asked by 11.04.2014 / 17:19
1
answer

How to update fields with fields from another table?

I'm not able to update a table with the select of another. I have a mdl_user table that contains several columns and created another users_sg to copy some columns. I copied with INSERT INTO users_sg (id, username, firstna...
asked by 17.08.2016 / 16:03
1
answer

How to select partially distinct lines?

I have a table whose column reference contains values constructed as follows:    Reference / Color / Size / Gender Examples: JOHN/WHITE/52/MALE JOHN/WHITE/51/FEMALE JOHN/BLACK/52/MALE JOHN/BLACK/51/FEMALE JANE/BLACK/XL/MALE JANE/...
asked by 06.01.2014 / 21:35