Most voted "sql" questions
Structured Query Language (SQL) is a language to query databases. Questions should include examples of table code and structure. This tag refers to the default language, not to be used for questions about the implementation of specific DBMS (such as Mysql, Postgresql, Oracle, MS SQL Server). In this case use the specific DBMS tag. Answers to questions marked with ANSI SQL should use SQL as much as possible.
Learn more…6,771 questions
Sort by count of
-
0
votes1
answer151
viewsHow to enter data from a form in the database [Pdostatment - CRUD]
I’m making a CRUD simple to insert data obtained from a form. I did the function but it does not work and does not present any error. I believe it’s because of the information coming from form are…
-
0
votes1
answer212
viewsCheck multiple Radio type input in a simulated
Well, I’m creating a website and I need to validate the radio input fields. I thought about using JS, but it didn’t work. As stated in the topic, there are several fields that I need to validate.…
-
0
votes1
answer24
viewsTrasnformar array in Divs?
I have a page php who brings me a registration list, but he brings a array and would like every item of it to come in divs or table with rows. Down with what I’m doing: $db = JFactory::getDbo();…
-
0
votes1
answer646
viewsImport Excell XLS Spreadsheet and write to Mysql database
NOTE: First excuse some ignorance, but I am beginner and do not understand in advanced PHP and SQL PROBLEM: I have some spreadsheets where I get some information, which is updated every 6 hours. The…
-
0
votes1
answer91
viewsGroup results in single line according to sequential
I have the following query: SELECT * FROM ARELBATIDATRANSITOVIEW WHERE CHAPA = 1234 AND CODEMP = 1 AND BATIDA IS NOT NULL She takes me back to this way: COD |DATA |BATIDA |ST |SEQ_BAT 1234…
-
0
votes2
answers109
viewsHow to use sprintf to create a query with date_format()
I am reformulating a system of a client and the same is using procedural mode in login and not PDO, but to give more security, I used the sprintf, but it’s not working. Look: $sql = sprintf( "SELECT…
-
0
votes2
answers4406
viewsInsert into with select
I need to do an insertion of the type INSERT INTO your_table SELECT * FROM temp_table; but, I need the id, and the second column which is an id_fk I can set. I need to transfer the tuple to another…
sqlasked 7 years ago rafaelprog 53 -
0
votes1
answer30
viewsFunction inside the sql server
I’m trying to make a function inside the sql server, however, I can not use it because of an error saying that the result consists of more than one line (Error Code: 1172 Result consisted of more…
-
0
votes1
answer74
viewsError nullpointer when query in database with parameter
When I run the query below I have a nullPointer error. @Query(value = "SELECT * FROM x WHERE USER_NAME = :name", nativeQuery = true) DataBaseCobilling findByCdIdent(@Param("name") String name); But…
-
0
votes4
answers70
viewsHow to return the sum of the business value column, month by month, based on the starting data_column?
I have the following table: I need an SQL statement that returns the sum of the business value_value column, month by month, based on the start data_column. Example: I need the name of the month and…
-
0
votes2
answers153
viewsCount in the Postgresql database
Good morning . I wanted to select in my bank and return the number of registered . Example: tb_client; column: dt_register; in the dt_register column I have this: 2000-01-20 2001-10-05 1990-11-09…
-
0
votes2
answers567
viewsQuery SQL Moodle
I have a problem, and I do not have much knowledge in SQL to mount a Query of this, that returns exactly this, I am working with Moodle, and I need to return with a query, as following information.…
-
0
votes4
answers3265
viewsSelect only 1st row of table
I need to select only row 1 of the table, I’ve used the DISTINCT and it didn’t work follows the Query: select Max(remessa.dt_uso_inicio) as DATA_REMESSA ,min(dt_entorc_oficina)DATA_ABERTURA…
-
0
votes1
answer991
viewsHow to make Foreign key one-to-many in mysql?
I have a table students and a table courses, my table courses have the course for example of administration, as I relate several students to this table using Foreign key ?
-
0
votes1
answer154
viewsHow to leave values in report with iReport(or TIBCO) only with 2 decimal places
I wanted to make sure my real values were only 2 decimal places in my report, but I don’t know where to declare it. On my application I declared all floa type…
-
0
votes2
answers147
viewsAccented words are not sent to the database - PHP
I made a form that sends data from a php page to a database and only the data without accentuation are being sent, if I put an accent, none of that field arrives in the database, not even something…
-
0
votes1
answer880
viewsQuery all sql tables
Good night I’m starting in the career of developer and I’m creating an application that will read an xml file. I am having difficulty passing a command in the sql database that returns all tables…
-
0
votes1
answer89
viewsActive record, how to replace Uniq with distinct correctly?
I’m trying to recover the months where I have answers to a survey this way: Answers.pluck('EXTRACT(MONTH FROM created_at)').uniq (0.7ms) SELECT EXTRACT(MONTH FROM created_at) FROM `answers` =>…
-
0
votes0
answers84
viewsAdd SQL base to a letter
Good afternoon! In a database I have two tables. A so-called Accounts, where you have for example a column of accounts 1(Active), 1111(Cash), 1112(Banks), 1113(Receipts). Another table called Values…
-
0
votes0
answers60
viewsHow to store images in Mysql
Speaks guys, I’m having a question: register image with encryption( that is only codes in DB ) or register local image, and save the image in a folder? NOTE: I don’t know if registering in the BD…
-
0
votes1
answer1537
viewsMedia calculation between SQL Selects
Good Afternoon Please help me out Error in the Syntax Msg 102, Level 15, State 1, Line 2087 Incorrect syntax near 'TAB'. --TARIFAS --Calcular Média Tarifada BEGIN TRY DROP TABLE #TARIFASINDMETRO END…
-
0
votes1
answer619
viewsDynamic Combobox Information Filter
I would like to know how to make a dynamic data filter, to appear only the data related to the selected, for example: I have in my bank the table Empregado and Empresa, as an example I have: Staff…
-
0
votes2
answers47
viewsLatest records based on a filter
Next, I need to bring in a query the last records that were not changed in the last 3 days from a ID specific, ex.: (id_chamado_status = '1').
-
0
votes1
answer73
viewsUpdate via another table - Mysql
I have the following problem: I have a table rev_tasks which contains id as key, and a second table rev_reviews and has as a foreign key task_id, pointing to the task, in addition I have a field…
-
0
votes1
answer85
viewsMerge select to totalize results
How to sum up the stored quantity of these products to be able to compare with the total order quantity for resale "QTD ORDER". How can I find the stored total and link to the result? Select: SELECT…
-
0
votes2
answers2427
viewsSQL Query VBA Excel
Good afternoon! I have a problem with a query in Access via form. The Form is from Excel vba, which connects to the database. Below is the complete code. This is the code of the button. Clicking…
-
0
votes1
answer32
viewsQuery to count how many fields equal to 0 a record has
I need to return how many fields equal to 0 each record has and rank the one with the most zeros down. Example: id | col2 | col3 | col4 1 | 1 | 0 | 0 2 | 0 | 0 | 0 3 | 0 | 1 | 4 4 | 0 | 3 | 5 5 | 3…
-
0
votes0
answers48
viewsQuery Performance - HELP
I’m making a query, but I am learning now. There is a way to improve the performance of this query? select a.COD_EMPRESA, b.Dat_pagamento from SAS_EMPRESA a full outer join SAS_ITEM_PAGO b on…
-
0
votes1
answer59
viewsSelect Qt Combobox column
I have a Connect button on the mainwindow.ui void MainWindow::on_pushButton_clicked() { ConectarDB = QSqlDatabase::addDatabase("QMYSQL"); ConectarDB.setHostName("localhost");…
-
0
votes1
answer26
viewsRelation between tables of the same values in the columns
I want to make an sql query that relates two columns of two different tables, which store the same types of values, but one has some that the other does not contain, example: Table 1 owns the code…
-
0
votes1
answer100
viewsUse conditional to check dates if not in a search column with null value
I have the following tables in BD Oracle 11g irrigation ---------------- militet_applied, close_date rainfall --------------- rain_index, reading_date And I would like to make a select similar to…
-
0
votes0
answers75
viewsImages saved in the BD and in the project root folder do not appear on the site
I’m progressing on a website , using the php language in netbeans and easyphp p database. the site registers companies and services and also it is possible to search by name the same. (It is in…
-
0
votes0
answers734
viewsSQL username and password
During the installation of SQL Developer 17.3.1 on Ubuntu 16.04, it did not ask user and password. In this case I cannot log in, is there any default user or some way to configure a user?
-
0
votes0
answers48
viewsTrigger in MYSQL to delete record when it exceeds a date
Hello how could I create a Trigger that deletes records from the database that exceed the current system date?
-
0
votes1
answer64
viewsRDS SQL Server AWS - Doubt about changing BD instance class
I need to change the class of the database instance, because I use the "micro" and need to change to an instance with larger resources. My question is whether while changing, I lose my current…
-
0
votes1
answer39
viewsDoubt - Query SQL Server 2012
I have a query below that I need to bring inside the case only when the field Tarvencimento is less than today’s date (so far I managed to do), however, only when today’s date is 5° day after the…
-
0
votes2
answers5013
viewsHow to add two columns?
I have 2 subselects, in SQL, that bring 2 different information, with the sum data. How to add the 2 "sums" and bring in a new column, or a single column? CASE WHEN sd3.D3_UM = 'PC' THEN (SELECT…
-
0
votes1
answer3105
viewsHow to assign the value of an Excel column in an SQL command
I was able to connect to my Mysql Database via ODBC, and display the information I need via SQL command, but I would like the contents of a particular cell of my spreadsheet to be in this SQL query,…
-
0
votes1
answer1418
viewsName table resulting from SELECT
I need to make a SELECT of the table resulting from another SELECT, but I need to refer it to ON of INNER JOIN. How do I do this in Oracle (PL/SQL)? I tried it this way but it didn’t work: SELECT *…
-
0
votes3
answers1885
viewsSelect different values in two tables - SQL and PHP
I have two tables to pedido_tb and the pedido_grade, what I want to do is compare, the values of the column "request" of the requested table and column "n_pedido" of pedido_grade, basically, would…
-
0
votes0
answers52
viewsTransform the rows of a column - SQL
Someone help me with the following question. Generate ".sql" extension file with script that transforms the lines of a column in a variable string, with its values separated by commas, for example:…
-
0
votes2
answers62
viewsWHERE SQL functions
I have the following query: $qrysel = "select * from won_auctions w left join registration r on w.userid=r.id where xxx; This query will show a list of users of the table won_auctions and take the…
-
0
votes0
answers265
viewsHow not to convert an exponential number to decimal?
Guys I’m having the following problem: I created a function to put the thousand point(s) in the values you receive as parameter (VARCHAR2). This function takes integer values and values of type…
-
0
votes0
answers482
viewsMicrosoft SQL Server Management Studio 17 Error
Every time I try to start Management Studio this error: Cannot find one or more Components. Please reinstall the application. I have already uninstalled SQL Server and Management Studio and…
-
0
votes1
answer597
viewsHow to return zero when JOIN does not bring me a value?
I have a problem with this SQL, when I need to list a drive but SMTITMVE the code has not yet been recorded. Ai when JOIN AND A.NCODIMVEPI = E.NCODIMVEPI.and JOIN AND D.NCODIEQEPI = E.NCODIEQEPI.…
-
0
votes0
answers25
viewsdatabase vendor code:521
I am unable to run these query in sql 2008 I took the test in 2014 and it worked Could someone help me? I’m too layman to bridge to find a solution. Follows the query: SELECT D1_COD, D1_FORNECE,…
-
0
votes0
answers122
viewsTransaction with Laravel
DB::connection('gtsql')->beginTransaction(); $seriefat = DB::connection('gtsql')->table('se_seriefat') ->where('c_codserie', 'FO')->first(); echo $seriefat->c_numultdoc; sleep(15);…
-
0
votes0
answers142
viewsMysql - Value limit for mathematical operations
I am in doubt about the following situation: I have two values not stored in table. Valor 1: 9223372036854775806 (Onde este é o valor máximo de um tipo de dado BIGINT) Valor 2:…
-
0
votes0
answers87
viewscode shows no error but still does not run DELETE
code shows no error but still does not run DELETE. I created a tag to delete line by line and I used GET for this and it’s still not working. tag <td><a…
-
0
votes1
answer707
viewsBulk insert into a table
I have two proc’s that my VB system already uses. One for Insert and one for Update. I need to use it now, directly in the database. The target table has a composite key, as follows. A field called…