Questions tagged as 'sql'

2
answers

How to read and open files from a byte column in SQL Server?

My question is the continuation of this question: Link to another question I was able to transform my file into bytes and insert it inside a table in SQL Server, however now I want from within an application that I'm doing in C # I want to...
asked by 09.12.2014 / 14:03
1
answer

Select products in a range of discounted values?

I'm trying to make a filter for values for a virtual store, I have a product table, one for stock and one for promotions.    Products CREATE TABLE 'produtos' ( 'id' INT(11) NOT NULL AUTO_INCREMENT, 'codigo' VARCHAR(255) NULL DEFAUL...
asked by 17.11.2014 / 13:07
2
answers

Display grouped data

I am doing a query in the database and am having difficulties with data duplication, so far, this is my query: SELECT * FROM tec_postagens tp INNER JOIN tec_historico_status th ON tp.protocolo=th.protocolo WHERE tp.protocolo = '1168' ORDER BY...
asked by 12.11.2014 / 13:50
2
answers

How to query with where and like between two tables?

I have the following problem: I have two tables, the following tables: tabela mensagens +----+-------------------+-------+---------------------+ | id | mensagem | _de | hora | +----+-------------------+-------+----...
asked by 05.12.2015 / 00:50
2
answers

Ulitization IS DISTINCT FROM - Postgres

What is the best use of this function in Postgres IS DISTINCT FROM , doing tests got the same result using COALESCE but in less time, follow the test: SELECT COUNT(P.id) FROM produto P INNER JOIN cliente CL ON P.id_cliente =...
asked by 20.11.2015 / 14:11
3
answers

How to generate SQL in relationship table without repeating values?

I have the following scenario: Tables: Video (id, url) VideoCategoria (id, id_video, id_categoria) Categoria (id, descricao) I need to get the last 120 categories that have received videos. At the same cursor I wanted the following fields:...
asked by 23.09.2015 / 15:27
2
answers

Merge two tables into a third table

I need to merge two tables imagem1 and imagem2 into a third table imagens with SQL . They have exactly the same structure but with 1 query I can not write all the data at once, so I need to do 2 queries. I need a SQL...
asked by 18.01.2015 / 14:10
1
answer

Problem saving result of a SQL query to a PHP variable

I have SELECT to return the value of a field of table funcionarionew , my idea is to save the result of SELECT on a variable and then insert the value of that variable into another table ( terminal_cartao ). In my co...
asked by 26.01.2015 / 18:37
1
answer

Search database with encrypted data

I have a database where the inserted data is encrypted through a function written in PHP, this function encrypts and decrypts. I need to search this table. For example, I search for "BRAZIL", but in the table "BRAZIL" is encrypted as: cd...
asked by 28.01.2015 / 16:40
1
answer

Mysql Stored Procedure Error

I have a connection table that I need to delete every month to include new data. I made a stored procedure to automate this process. This table has about 3 million rows in a monthly period. This may increase or decrease a bit each month. I ma...
asked by 06.08.2014 / 14:57