Questions tagged [qsqlquery]

The QSqlQuery class, part of the Qt framework, provides a means of executing and manipulating SQL statements.

QSqlQuery encapsulates the functionality involved in creating, navigating and retrieving data from SQL queries which are executed on a QSqlDatabase.

Documentation can be found here.

417 questions
0
votes
2 answers

Can't execute mysql querys with QT

I'm trying to connect and execute a query with the QT framework, I can connect to the mysql db and I have tested the query and verified it works on the database. I think the mysql driver is correctly installed because I can connect and it doesn't…
INdek
  • 107
  • 3
  • 5
0
votes
4 answers

How far does optimization in sql queries go?

My background is application programming and there is a guideline that says to not try to "outthink" the compiler e.g. JIT etc when it comes to optimization. Is this the case also with SQL queries? I mean I have read that the SQL servers do some…
Cratylus
  • 52,998
  • 69
  • 209
  • 339
0
votes
1 answer

Read row currently selected by user in Qsqlquerymodel

I have a QSqlQueryModel table. The user can see and access this. I want to know which row/rows that the user selects. I have looked through a lot of other posts and documentations from qt-centre and I think the closest I believe is to somehow use…
Cameron R
  • 149
  • 2
  • 9
0
votes
0 answers

SHOW CREATE VIEW | TABLE from mysql does not report any row in QSqlQuery

in my Qt (4.8.1) based application I need to retrieve the definition of a view stored in a MySql database. The code I'm using is QSqlQuery query; query.prepare(QString("SHOW CREATE VIEW %1").arg(viewName)); qDebug() << "actually sending this…
0
votes
1 answer

QT5 and QSqlResult.h

I am trying to port my code from Qt 4.8 to Qt5. I find that enum VirtualHookOperation is not populated in line 128 QSqlResult.h. In Qt5 the enum is empty. I dont find this change mentioned anywhere in the changes-5.0.0 document. I am trying to build…
sky
  • 115
  • 2
  • 10
0
votes
1 answer

QSqlQuery doesn't answer correctly

I tried to create a SQLite database with Qt and and I did!! I called my db "prova_db" and it contains the following table: marker_db id site (columns) 0 www.google.it 1 www.youtube.it 2 www.facebook.it Then, I tried to query my…
Cristina1986
  • 505
  • 1
  • 8
  • 21
-1
votes
1 answer

SQL query to reduce number of rows using grouping values in lesser number of rows

I have set of data which looks like below I want to reduce the rows in it. If possible to reduce up to single row then it would be considered as best case. Final data set should something like this I tried Min and Max functions in SQL. But I don't…
Pravin
  • 1
  • 2
-1
votes
1 answer

Filtering data using SQL

In R studio, we can subtract the value of column B from Column A and store it to a new column C. Then next step we can calculate, get sum, average and all kinds of calculation on it. How can I do the same thing with SQL in big query? It does not…
-1
votes
2 answers

query is not mean to be a copied. Use move construction instead

I've been doing a code where a database is manipulated, elements are saved and edited by a Qsqlite database and query, so the way I've used is to pass query by parameter I don't know how bad it is but every time it goes By parameter I get this…
-1
votes
1 answer

how to extract the today's date out of the date column using SQL query?

I assume I would need to change query in order to sort the data with today's date. Please tell me how to change it though... SQL QUERY in ToDoDao @Query("SELECT * FROM todo_table WHERE date(date) = date('now')") fun getTodayList():…
-1
votes
1 answer

How to get the avg for groups i created SQL Query

my SQL code not working (syntax error at or near "FROM") i need my final table to be three rows. the average of standard_amt_usd for the three total group i created from Total column. where is my mistake? select avg(orders.standard_amt_usd),…
Pythona
  • 9
  • 5
-1
votes
2 answers

Sql query about update multiple attributes of same field by single query

I want to update multiple attributes of same field in SQL. How can I write a single query to perform this task in SQL? I am attaching the picture for assistance to this question. Please suggest me one line query to perform this task, i.e. to update…
-1
votes
1 answer

How to join two table without null data

I have two table named demoa and demob containing both same field ID and Name. For ex : Demoa table containing data like | Id | Name | | 1 | divya | | 2 | saumya | | 3 | urvasi | Demob table containing data like | Id | Name | | 1 | karan…
s.k.Soni
  • 1,139
  • 1
  • 19
  • 37
-1
votes
3 answers

How to query to Fetch Data of each Name in List for a Date Range

I have a table like Name Total Date A 10 2020-12-01 B 5 2020-12-01 A 10 2020-12-02 B 15 2020-12-02 now I have a List of Name and Date List Like @NameList = '[A],[B],[C],[D]' @DateList = …
-1
votes
1 answer

How can I Create a SQLlite table and insert data in it in QT at Compile time?

I am working on a QT program where I have to create two SQLite tables and insert data into one of them. I have a void function called configuraBaseDatos that does it in runtime. How can I get it at compile time? Here's what I tried: void…
JC2102
  • 55
  • 2
  • 5