I am trying to find the percentage completed on a table with a sub-query. I can successfully get the value I need using the following, but I am concerned that I am unnecessarily using two queries to …
Tag: sql
SQLDataReader does not show value of column with double colon in field name
A Select query works fine when I enter it in SQL Server Management Studio on SQL Server: SELECT [00:00] FROM MY_TABLE WHERE whatevercondition … The column name is “00:00” – it has a double …
Filter data from database with multiple user selections
Currently I’m developing a search form so my SQL query needs to change with user input. Please see the below code sample. $sqlSearch = “SELECT * FROM seafarers WHERE “; if ($dateS != “”) { $…
PostgreSQL – Subtraction based on column data simplifying query
I’m trying to subtract data from the table based on another column which represent their category. For example: +—-+——–+———-+ | ID | Amount | Category | +—-+——–+———-+ | 1 |…
Replicating functionality of excel cell referencing (or calculations over multiple views)
I have a table with 3 columns that contains a number of data streams all in one table. val_name is the name of the data stream, val_sequence is the incrementing sequence number and val contains the …
How to check if column has value if another column is populated in SQL Server?
I am trying to find a way to see if I can write a query to check a table to return any row that is missing a dependency if that makes sense. For example let’s say I have the following columns: …
Spring Data Insert Data when entry not yet exists
SCENARIO: I have a MySQL Database where I have one Table with a Mapping of a user and a product. My Application offers an api so I have to be aware that the mapping will not be done multiple times. Therefor I want to check if the two ids( of the user and the product) are already mapped. PROBLEM: I
sum columns of a table, grouping by table partition
I have a table which holds daily metrics : |DateID | Metric1 | Metric2| 20190501 24 34 20190502 25 56 ….. …. …. The table has more than 150 million rows. …
In SQL how to calculate days in a year based on a start date and the number of days lapsed
What would be the SQL to calculate the number of days in each year if I had a start date and the number of days that have lapsed? For example, the date (ymd) 2013-01-01 and the days lapsed is 1000. …
How to insert a random integer number, for a given column and several rows
I was wondering.. Is it possible, with a SQL query, to: generate randomly, a list of integer number insert this in a table, for a specific column, and for multiple rows I didn’t try anything, to be …