Skip to content

Tag: sql

Getting the floor value of a number in SQLite?

I have a SQLite database with a table containing the scores of some league players in a bowling center. I’m trying to get the average of the Score column for each player ID. The problem with this is I only need the whole part of the average, and it should not be rounded (example: an average of 168.99 sh…

sql query with a case when returning more than one row

I’m trying to do a query with a case when condition to see what list I will show but I’m having this error ORA-01427: single-row subquery returns more than one row. the query is this: is it possible to call a query with more than one row inside a case condition? Answer I would do this in multiple …

SQL speed up performance of insert?

I am performing some test on sql server and I want to get the best insert speed possible. The statement I use is something like this: INSERT INTO db_Test_databse..tbl_test with(rowlock) ( …

Group by every N records in T-SQL

I have some performance test results on the database, and what I want to do is to group every 1000 records (previously sorted in ascending order by date) and then aggregate results with AVG. I’m actually looking for a standard SQL solution, however any T-SQL specific results are also appreciated. The qu…

SQL calculating time between assignments

I have to write an SQL statement which contain a field that contain two different values consecutively but in the way I have wrote it, it return always null because it is interpreted as having the two value in the same time! My conditions should be : (ci.field = ‘Group’ and ci.oldString = ‘T…