Questions tagged as 'sql'

2
answers

how to get an element from a table

Speaking of variables that can be declared inside begin, I've seen that it has Declare and set only that I do not know when to use them. I have set x, set x, set x = x + 1, set x: = x + 1; they all confuse me and I do not know what they are for....
asked by 12.10.2015 / 21:28
4
answers

If no where condition SQL Server

I have a Stored Procedure where I need to do a check for a date filter, if the start date is null I have to do in WHERE to get all records smaller than the end date, otherwise I make BETWEEN between dates. Example If...
asked by 15.11.2018 / 12:26
1
answer

How do I select multiple fields in the same query?

I created a dummy bank with the following structure: BelowarealsothenumberedSQLServerscriptsforcreatingthedatabase,ifneeded. SQL Fiddle Now, what I want is to make a query where they are shown: The limit of an additional holder - pre...
asked by 05.09.2015 / 22:00
2
answers

Inner join 3 tables

I have the following query. $cmd = "SELECT ofertas.id, ofertas.titulo, ofertas.descricao, ofertas.valor, ofertas.user_of, ofertas.categ, ofertas.local, ofertas.fav, favoritos.id_oferta FROM ofertas INNER JOIN favoritos ON ofertas.id=favorito...
asked by 04.09.2015 / 15:59
3
answers

Return the Id of table 1 and insert in table 2 in the same code

Next, talk with 2 tables (Group1 and Group2), so I have a form that has several fields that will be inserted at the same time in these 2 tables. But I need to insert into the Group2 table the Id of the Group1 table that was just generated in tha...
asked by 15.03.2016 / 15:32
1
answer

SQL Query Returned Null, Empty for JSON

I'm in trouble !! I have two tables 'user' and 'post' when I use phpmyadmin to do the following query it returns me the values as I expect. SELECT usuario.nome, usuario.foto_profile, post.titulo, post.descricao, post.local, post.latitude, pos...
asked by 29.11.2015 / 17:05
1
answer

Incorrect information when loading bigdecimal entity

I have a table, that one of its columns is a numeric (25,10) that will be shown rates. But there are records that will be reset (0.0000000000) In my entity you have ownership of this fee, such as a BigDecimal . But when hibernate populat...
asked by 04.08.2015 / 22:28
2
answers

How to get the sum of three tables in sql

I have 3 Tables, which are: School: id , id_escola and nome_escola ; Teacher: id , id_escola and nome_professor ; Students: id , id_escola , sala_aula and numero_alunos ;...
asked by 30.07.2015 / 16:55
2
answers

SQL Count ROWS

Good! I have two tables: A: PRINTER (ID), DATE, STORAGE, TYPE B: Autoreg (ID), PRINTER, PRODUCT And I wanted to have a type result: TotalCombustible, TotalStore, Mixed Where the Fuel is when the product is = 1, the Store is >...
asked by 09.06.2015 / 18:11
2
answers

Conversion specified is not valid in ExecuteScalar

The specified conversion error is not valid in the code: if (command.ExecuteScalar() == DBNull.Value) { resultados[j2][i2] = 0; } else { resultados[j2][i2] = (double)(decimal)command.ExecuteScalar(); /* <<---- */ } The query...
asked by 26.01.2016 / 20:40