I am having some trouble getting the data I want from a Typeorm query. Basically, we have a search bar for the users to search our database of products (medicines). I want to select all records from the database that include every word the user entered. (These words are split into an array of values.) It migh…
Tag: sql
How to use the results of one query in the next query?
I have read answers here but I am still not quite sure how I would do this regarding two columns of a table and more than one result per query. So, the first query would look like this in my Node app: …
If today is friday then extract data 7 to 9 days from today, if not 7 days
If today is Friday, I would like to get data 7 to 9 days from now, if not 7 days. I am using SQL Server. Before: id class startdate 1 English 2020-12-21 00:00:00.000 2 English 2020-12-22 00:00:00.000 3 Math 2020-12-21 00:00:00.000 4 English 2020-12-27 00:00:00.000 5 Math 2020-12-27 00:00:00.000 If today is 14…
How to map from query string to SQL query? [closed]
So I have as search endpoint [HttpGet(“search”)] public async Task Search([FromQuery] string query) that returns a list of users from the cosmosDb based on email, name …
How can I get SUM result as an alias in MYSQL?
The code I wrote above results show like this. I want to know how to Sum numbers in the column ‘COUNTSVCE’. The column ‘COUNTSVCE’ is an alias of count(SVCE_DOMAIN). Rollup function might be a good solution but I can’t use it in my JAVA query so I get the result as alias. Thank y…
SQL Plus Columns getting overflowed to next row
The DeptNo column when using SQLPlus in Oracle 11g XE is getting pushed down to the next row, despite having sufficient space in the window in Ubuntu 20.04 Terminal.
How to use a for loop to insert multiple records in a database table
I have simplified my problem into the following code: $sql_abc = “CREATE TABLE $tbl_abc( x INTEGER(255) ) “; echo “About to execute $sql_abc”; if (mysqli_query($conn, $sql_abc)…
Oracle optimize select after update status performance
I have a store procedure that will Update maximum 500 rows status from 0 to 1 Return those rows to program via cursor Here is my store procedure code PROCEDURE process_data_out ( o_rt_cursor …
Mysql subquery in where clause that returns comma separated value
I’m not really good at subqueries, here’s the sample tables that I have. table customers ===================== id | name | order_ids 1 | John | 1,2 table orders ===================== id | name 1 …
Using Over() with aggregate functions while calculating percentage
I am writing a query to print Total Students in each department in a college, I also want to print the percentage of those students in each department out of Total students in the college. Having issues with calculating percentage, the above query throwing an error dbo.Student.Id is invalid in the select list…