Questions tagged as 'sql'

1
answer

Filter records by Month / Year Codeigniter

I have the following SQL structure: CREATE TABLE IF NOT EXISTS 'noticia' ( 'id' int(11) NOT NULL AUTO_INCREMENT, 'id_categoria' int(11) DEFAULT NULL, 'titulo' varchar(255) NOT NULL, 'previa' text NOT NULL, 'descricao' text, 'imagem...
asked by 02.11.2015 / 15:47
2
answers

Doubt using RIGHT JOIN on Sql Server

How could I return the results of these three tables, even if I did not have a relationship between them. Thank you SELECT A.IDPLANOCONTAS, A.NUMERO_CONTA AS NUMERO_CONTA1, A.DESCRICAO_CONTA AS DESCRICAO_CONTA1 , A.OPERACAO AS OPERACAO1,...
asked by 01.10.2015 / 04:49
0
answers

Perform subtraction using aggregate functions

I have a real estate table with the code , price and area fields. I need to figure out what the price difference is between the largest and smallest of the table (in a matter of area). I tried this, but the difference between the highe...
asked by 02.09.2015 / 21:28
2
answers

Search with date range [duplicate]

In MySQL I have a table that has two DATE fields: data_inicial and data_final . In the System I have a Field (TextField) where I type a date. This date does not need to be accurate, but rather matches the range. Example:...
asked by 05.10.2015 / 23:05
1
answer

SP_HELPTEXT without formatting

When a Trigger is compiled by TOAD for SQL, using the F9 button rather than F5, it is inserted into syscomments in the wrong formatting, as if it were a single line, where line breaks are disregarded. The problem is that when I use sp_helptext t...
asked by 28.08.2015 / 20:11
0
answers

show similar product / property with php and mysql

I'm developing a feature on my site to show similar properties by title and valo9r, but my idea did not work: <?php //Armazeno o resultado do titulo da consulta anterior da tabela imoveis em um variável $titulo_semelhante = $results['titulo...
asked by 25.08.2015 / 19:20
2
answers

How to consult a table in a limited (partial) way?

I need to consult a table by extracting from it the infos: <nome> and <pontuacao> , my tcc is a game where one of your options is to see a Ranking of players registered. as there is a possibility that the soft grow in nu...
asked by 10.09.2015 / 19:31
1
answer

foreign key php database

create table cliente ( id_cliente integer auto_increment, nome varchar (100), primary key (id_cliente) ); create table produto ( id_produto integer auto_increment, id_cliente integer, nome_produto varchar (100), r...
asked by 27.08.2015 / 15:40
1
answer

Query with two summations for the same column

Is it possible to do a query where two sums are executed on the same column in the same query? What I have is the following: Total sales sum select month(emitido_date) as mes, ifnull(sum((det.preco * det.quantidade) * (iva.valor/100) +...
asked by 11.08.2015 / 10:33
0
answers

Referencing a group of ID's resulting from 'group_concat'

I have a select that returns the equally repeated lines, along with the total. I need to reference this group of ID's to pass as an argument. The result of my query is the array below. Basically it counts how many lines has Papa Charlie in...
asked by 29.07.2015 / 21:23