Posts by Emerson JS • 1,574 points
57 posts
-
1
votes1
answer113
viewsQ: Multiple sharing users when installing SQL Server
I recently installed the SQL Server Express 2016 on my machine with Windows 10. After a while I realized that on the menu "Share with" windows appeared 13 new entries in format SQLEXPRESSNN, where…
-
0
votes1
answer2845
viewsA: SQL Server - How to guarantee permission from SELECT to View without giving permission in the base tables?
Apparently there is no way, at least in the above scenario, to grant permission to SELECT for userX in viewABC without also granting permission to SELECT in table. What can be done is circumvent the…
-
0
votes1
answer136
viewsA: INSERT inside WITH clause
You have two ways to do this type of operation. One is by using Common Table Expression (CTE) as in your example, and the other is using a "temporary table". I believe the error you reported is due…
-
3
votes1
answer2845
viewsQ: SQL Server - How to guarantee permission from SELECT to View without giving permission in the base tables?
I need help with a problem involving permissioning of objects in the database. I have the following scenario: 1 Database 4 Schemes different with the following owners: schemaA; proprietary dbo…
-
6
votes1
answer9356
viewsA: Query data in two tables and add one of the columns
To get the expected result you need to make a JOIN between tables. Also, you need to use aggregation functions with GROUP BY to be able to group and sum the values. Your query would look like this:…
-
0
votes1
answer448
viewsA: How to Select a table row and display information in another table relative to the table?
When we distribute data in several tables in the database we make links that indicate some kind of relationship among them. Normally these relationships are represented by fields we call foreign…
-
2
votes2
answers6935
viewsA: Concatenate values from the same column
Try this, see if it solves your problem. SELECT s.formulario, CONCAT(CASE WHEN s.a1 = NULL THEN "" ELSE CONCAT(s.a1, " ;") END, CASE WHEN s.a2 = NULL THEN "" ELSE CONCAT(s.a2, " ;") END, CASE WHEN…
-
1
votes1
answer144
viewsA: Self Relationship
In this particular case it was not clear whether it really is about self relationship. Maybe you should change your question a little to give more details. But speaking of your consultation, try…
-
3
votes2
answers114
viewsA: Return original Textbox formatting
You can add one more test in your routine, to change the background color only of TextBox who is not with the property ReadOnly configured for true. See if it works: public void…
-
1
votes1
answer338
viewsA: Format subitem listview
Your code is correct, but it lacked a detail that makes all the difference: configure the property UseItemStyleForSubItems. When you create your items to popular the ListView they must have the…
-
1
votes1
answer4546
viewsA: Value of the first cell of the selected line datagridview
Hello, you already have the selected line, and you already know which spine who wants to update, so it’s simple. Access the line collection through the property Rows, and from the desired row access…
c#answered Emerson JS 1,574 -
4
votes1
answer32
viewsA: Logging
As @rray already quoted in the comments, use GROUP BY. SELECT ip, id_noticia FROM visualizacoes WHERE MONTH(data) = MONTH(NOW()) AND id_usuario = :id_usuario GROUP BY ip, id_noticia; With GROUP BY…
mysqlanswered Emerson JS 1,574 -
3
votes1
answer61
viewsA: SQL error while trying to Update with PHP
Gabriel, first let’s imagine what a UPDATE, regardless of using the PHP to run it. It would be something like: UPDATE nome_da_tabela SET campo1 = valor_campo1, campo2 = valor_campo2, campoN =…
-
3
votes1
answer3954
viewsA: INNER JOIN WITH ORDER BY
Hey, buddy, try this. SELECT p.*, pf.* FROM produto p INNER JOIN produto_foto pf ON p.id = pf.idproduto INNER JOIN ( SELECT id FROM produto_foto WHERE primeira = 1 UNION SELECT MIN(id) AS id FROM…
-
1
votes2
answers188
viewsA: Select with date returning empty
The problem must be in the fact that you compare your field imp_data with NOW, representing the current date/time. If you want to list the records with imp_data equal to current date, use CURDATE in…
mysqlanswered Emerson JS 1,574 -
3
votes1
answer123
viewsA: Locate specific day of the week between dates
You can make a query in your table looking for the last occurrence of the day of the week who is trying to schedule. For the example of Friday it looks like this: SELECT MAX(data_agenda) AS…
-
3
votes2
answers75
viewsA: Query with calculation returning error in condition
Are you using the alias of the column in the WHERE. The bank does not recognise this column in the case ESTTRAN. Alter your query for that reason: SELECT imp_loja AS LOJA, imp_item AS ITEM, imp_desc…
mysqlanswered Emerson JS 1,574 -
2
votes4
answers6185
viewsA: What is the difference between match_parent and fill_parent?
In practice, there is no difference. match_parent replaced fill_parent from the API Level 8. See the Android documentation:…
-
1
votes2
answers906
viewsA: Calculate difference between dates and change status
To update the column according to the date conditions you can use something like this: UPDATE suatabela SET status = CASE WHEN CURDATE > data_vencimento THEN status1 ELSE CASE WHEN…
-
2
votes1
answer48
viewsA: Error doing a Return in windows form c#
What happens is that your instruction LINQ returns a anonymous type. var minhaQuery = from su in _contexto.SubCategorias join c in _contexto.Catgorias on su.CategoriaId equals c.CategoriaId select…
-
3
votes2
answers345
viewsA: Values that can be entered as primary key
To primary key should be a field, or set of them, that identify the record. If the field cited by you fits this situation, it may be a primary key. Just one caveat: this field in XX0000 format will…
-
3
votes4
answers1102
viewsA: How to show data from 2 tables in a grid?
If I understand correctly, you already have the method Localizar that returns you a object list of the kind Subcategoria. What you need to do is relate this list to a DataGridView. I’ll assume you…
-
6
votes7
answers68940
viewsA: How to make SELECT with ORDER BY and different criteria?
You already have several answers, this is just one more way to do it: SELECT id, nome, CASE WHEN id = 100 THEN " " ELSE nome END AS ordenacao FROM categoria ORDER BY ordenacao We created a…
mysqlanswered Emerson JS 1,574 -
0
votes1
answer78
viewsA: Tbquery back N records
You can use the method MoveBy(Distance: Integer). With this method you indicate in the parameter where you want to move the cursor of the current record. Values positive move the cursor to forefront…
-
4
votes1
answer264
viewsA: Create select with multiple fields
In a relational database we store the data in tables. These tables relate through foreign keys (FK - Foreign Key). Usually the primary key of one table will be present in another, which relates, in…
-
0
votes1
answer416
viewsA: JOIN 3 tables +1 JDBC junction table
Good, come on. Apparently there is no problem in your query. Given the scenario exposed by you can only imagine that not all tables have the records to do JOIN, which would end up limiting the…
-
1
votes1
answer5960
viewsA: How to view data from a foreign key table in my main table?
Good, the information that you want to display is in another table, it’s not even? You want to show off the field grupo_nome that’s on the table grupo. On your table of produtos you have a…
-
2
votes1
answer66
viewsA: Create pagination by displaying current records at the top of the list
Friend, what will determine this is the result of your consultation with the bank. So, use a ORDER BY with DESC to invert the result. Just choose which field determines which records are most…
-
2
votes2
answers106
viewsA: Error importing csv files from FTP to the application
Come on, what happens is you’re trying to upgrade the screen from a different thread of that responsible for managing the components (the thread responsible for this is the Uithread). Your method…
-
1
votes1
answer354
viewsA: How to convert mysql search result into columns
Yes, it is possible to do what you want with a query, but we have some limitations. For example, you would have to build the query already knowing how many columns you would have resulted, that…
-
6
votes2
answers254
viewsA: Difference between relational table and online record
The structure you set up, with tables companies and categories and a third relationship table follows the concepts used in relational database. Then we can start with questions like modeling,…
-
3
votes4
answers5492
viewsA: Difference between two dates, ignoring weekend - working days only
Friends, just one more way to go: public static int CountDiasUteis(DateTime d1, DateTime d2) { int fator = (d1 > d2 ? -1: 1); List<DateTime> datas = new List<DateTime>(); for…
-
3
votes2
answers47
viewsA: Update date summing in bank
You can use a UPDATE to update the final date field when it is NULL. Thus: UPDATE minha_tabela SET data_final = DATE_ADD(data_inicial ,INTERVAL 30 DAY) WHERE data_final IS NULL; This directly in the…
-
1
votes0
answers346
viewsQ: Make Calls / Send SMS between Android emulators
Using the AVD Manager, created two devices - one with API level 22 and another with API level 23. Loading both devices with the emulator, I would like to make calls and send SMS from one to the…
-
1
votes1
answer157
viewsA: Problem with Mysql and PHP query
Based on what you reported in the comments, already tried to do different? Thus: public function listLicitacoesEntidadesCidades($date, $municipio, $entidade){ $stmt = $this->pdo->prepare("…
-
3
votes1
answer1191
viewsA: Unsupported on-disk Structure
Friend, I have seen this error occur when the database was created in a certain version of Firebird and then the file was copied to another machine with different version. Furthermore, please also…
-
3
votes5
answers29127
viewsA: use if in sql server
I’m not sure I quite understand the question, but come on. You could do 3 SELECTS and use UNION to return everything at once, like this: SELECT CamposDaTabela, CampoCliente FROM OrdemDeProduçao…
-
2
votes2
answers360
viewsA: Correct way to make a great Inner Join
Buddy, what happens is that if you just add the INNER JOIN without indicating the links between the tables you will have as a result of the query an amount of records equal to multiplication of the…
-
4
votes1
answer139
viewsA: Category query in Mysql
Come on, if I understand your question correctly you need to make an appointment that returns sales from a given one category. It turns out that category is not present in sales table, it’s not…
-
2
votes3
answers982
viewsA: How to verify encrypted passwords with user input passwords in the database?
Since your hash generation algorithm generates the same values when applied over the same parameters, you can compare the encrypted user input with the encrypted bank value. So according to your…
-
0
votes2
answers105
viewsA: Query bringing all records, and filter the repeated
Friend, if I understand your question correctly, try something like this: SELECT * FROM mov_pallet mp INNER JOIN (SELECT MAX(movpallet) AS movpallet FROM mov_pallet GROUP BY rua, altura, posicao)…
-
1
votes1
answer390
viewsA: How to transfer the row of a table in column
Buddy, try applying a MAX in each column resulting from CASE WHEN. Something like that: SELECT r.usuario, MAX(r.col1), MAX(r.col2), MAX(r.col3) FROM (SELECT usuario, op_nome, CASE WHEN…
-
1
votes2
answers64
viewsA: Return Attribute group of a specific category
Follow new select, with the restrictions you reported in the comments. See if it solves your question. SELECT r.*, cat.id_cat FROM ( SELECT a.id AS id_pai, '1 - Categoria' AS rotulo, a.nome_atributo…
-
0
votes1
answer113
viewsA: Datareport Landscape VB6
I may be mistaken, friend, but it may be that the problem is related to the size of the paper set up in the standard printer installed on the machine. See these Microsoft articles:…
visual-basic-6answered Emerson JS 1,574 -
2
votes2
answers145
viewsA: Check Smartphone Current Time
Friend, you can solve your problem using the class Alarmmanager (https://developer.android.com/reference/android/app/AlarmManager.html). With it it is possible to schedule the execution of a code,…
-
0
votes2
answers1031
viewsA: calculate how many hours between call opening date and current date in pl/sql
Friend, you can use DATEDIFF (https://docs.oracle.com/goldengate/1212/gg-winux/GWURF/column_conversion_functions011.htm#GWURF780). You can also use the suggested approaches in this Soen post:…
-
1
votes1
answer265
viewsA: Identify and archive old Mysql records
Friend, I believe that the best solution is really to create a table that receives these records "obsolete". You could create a job (http://dev.mysql.com/doc/refman/5.7/en/events-overview.html)…
-
7
votes3
answers1496
viewsA: Why is it possible to define two or more methods with the same name in the same class in C#?
This "duplication" is what we call method overload. A feature present in object-oriented languages. Although the name is the same, as in your example SendCode, the signatures of the methods are…
-
1
votes1
answer88
viewsA: Extracting File with Progressdialog
Good afternoon friend. What may be happening is that your file extraction process, running on main thread (UI Thread), should be harming the screen update, "freezing" the screen, then your dialog is…
-
1
votes1
answer150
viewsA: Bring Records You Don’t Have - 3° Table
Now yes, it is returning according to what you want, but if you allow me a suggestion, for this specific query, we could have a table for segment, because as you can see in the solution, I had to do…
mysqlanswered Emerson JS 1,574