Questions tagged as 'sql-select'

1
answer

MySql display the sum field with value null

I've researched but not found anything I need. I have a table where I have the record of debit and credit postings. These values are in the 'value' field. But I want to display this field in two columns, one for debit and one for credit. I...
asked by 15.04.2016 / 17:04
3
answers

I need to list a text field with values separated by;

I have a text field that is being inserted into the same phones in this format: 11 2222-3333;12 9 1111-2222;18 1111-2222;11 2222-3333 I need to list these fields as if it were a simple select in line and column . the result...
asked by 13.06.2014 / 04:26
2
answers

Error in SQL result

Well, this is what I'm doing, I'm having to do a select in a database, where I should look for values that exist between two dates, and that have a specific user. I made the select like this: SELECT * FROM 'tabela' WHERE 'data' BETWEEN 'dataIn...
asked by 31.05.2017 / 21:01
2
answers

Masking SQL Select Return

I'm using the following SELECT to return the IDs of a table. SELECT id, duracao_sessao FROM usuario For ID 1 I want the text "Object" to be displayed For ID 2 I want the text "Class" to be displayed For ID 3, I want the text "Struc...
asked by 02.12.2017 / 19:06
1
answer

SQL Select highest value item

I'm using the NorthWind database, and I want to select the category that has the largest number of items entered. I was able to list the category ID and the number of products it has with the following command: SELECT CategoryID, COUNT(Product...
asked by 26.11.2017 / 20:23
1
answer

SELECT ... WHERE LIKE name bind_param

I have the following code: <?php $link = new mysqli("localhost", "root", "minhasenha", "meu_db"); $produto = $_GET['q']; $produto = '%'.$produto.'%'; $busca_produtos = $link->prepare("SELECT id, nome_com from clientes where nome_com...
asked by 01.08.2017 / 20:45
2
answers

How to give ALIAS with current "mes / year"?

Considering the query below, I need the ALIAS where the SUMS exists, stay as "current / current_name" ("ABR / 14", "MAI / 14" ...) dynamically. SELECT fornecedor.codigo, UPPER(fornecedor.razaosocial) AS fornecedor, FO...
asked by 19.11.2014 / 20:24
2
answers

I need to list the quantity of an 'X' product that each customer bought

Below is the structure and relationships of my database. I tried to use the code: 'SELECT 'cliente'.'Nome', 'produto'.'Descricao', 'contem'.'QuantItem' FROM 'cliente', 'produto', 'contem' INNER JOIN 'pedido' ON 'cliente'.'Codigo' =...
asked by 12.09.2017 / 20:52
1
answer

I can not do SELECT

Model: public function exibir_noticia() { $consulta = $this->db->query('SELECT * FROM Noticia_Site_Cairu'); return $consulta->result(); } Controller public function index() { $this->load->model('noticia_model');...
asked by 13.10.2016 / 17:11
1
answer

Perform mysql query of two tables via php

Good afternoon, guys. I have a problem that I no longer know how to solve. I have the following mysql query in php: mysql_select_db("banco", $conexao); $resultado = mysql_query("SELECT * FROM pessoa WHERE id = '" . $cod . "'"); whil...
asked by 14.05.2015 / 22:08