Questions tagged as 'mysql'

2
answers

Counting strings reached PDO

I'm doing a query and need to count the number of rows returned, I'm not usually accustomed to doing this in PDO, follow my code below. $sqlCODCEL = $conn->prepare("SELECT * FROM tbl_CELULAS WHERE TXT_CODIG_SECUR = :codCEL"); $sqlCODCEL->...
asked by 24.08.2015 / 13:47
3
answers

How to perform a select by multiple fk?

I have a question about one (or more) select . I have the following bank set up and I need to do a search for a particular recipe based on one (or more, and oh, that's the problem) ingredients. How do I get the recipe that contains all the...
asked by 23.03.2018 / 04:55
2
answers

Mount INSERT from SELECT

I would like to make a select and from it generate insert . I want to start from the preposto that I do not know the table structure, the number of columns, nothing more than the table name. select * from cliente where nome like '...
asked by 07.08.2018 / 19:56
1
answer

How to load data to MySQL faster?

I have a DER that represents an airport and I have to load data from several csv there. for example I have a connection from 1 to many, from airline to flights. If I have this table linked with the foreign key it gives me error loading data so I...
asked by 15.09.2015 / 03:56
2
answers

Include strings in BETWEEN and List missing values in SQL query

Next. Imagine that I have in the bank in the field of paid months the following launches: 2015-03, 2015-04, 2015-7, 2015-9. If we stipulated a period for example: from 2015-02 until today (2015-9). What months are missing, ie, which months have...
asked by 24.09.2015 / 14:50
1
answer

How to set up a field using three others?

I have the following fields in the database: | id| estados | cidades | categoria | todosjuntos | | 1 | mg | sao paul| informati | mg/saopaulo/informati | The first 4 are populated, but I would like to insert in the todosju...
asked by 10.10.2014 / 23:25
1
answer

Discover the numbers that least appear in the records

Personal greetings. I have a table something like this: reg num0 num1 num2 num3 num4 num4 1 4 2 5 8 10 15 2 3 7 8 15 20 21 3 14 10 6 21 17 1 4 1 4 8 10 16 7 5 9 3...
asked by 12.11.2015 / 04:24
3
answers

Is there a way to start a Select (SQL) in the middle of the data table?

Is there any way in the SQL language (and using BD mysql) where I can start a Select in the middle of a table? For example, I have 500 addresses in the table. I search the addresses of Bairro X (where neighborhood="x"), reducing the total to,...
asked by 19.12.2017 / 16:35
1
answer

SUM expression expression not working

I'm trying to make a SUM in a query that performs some calculations. Here's the example: SELECT SUM ( (qtd - qtd_devolucao) * valor AS total) FROM produtos WHERE id_pedido = '47' I'm having the following error:    # 1064 - Yo...
asked by 28.07.2017 / 13:16
2
answers

How to display the total rows of a table in a label

I do not know how to pull the total rows of a table, code: public string Eventos { get; set; } SqlCommand comando = new SqlCommand("SELECT count(*) FROM Active", conn); SqlDataReader leitor = comando.ExecuteReader(); while (leitor.Read()) {...
asked by 26.09.2017 / 18:08