The issue is simple to explain, but seemingly not so simple to solve. This SQL query returns 0 rows: This one, however, returns 1 row as I expected: The only difference is the lack of INNER JOIN with the org_depts table. What I want to be returned is all the column values from app_handover, which references sys_logins.id in its sent_by
Tag: sql
Find a record containing all or a part of a list of id of other table in a many-to-many relation on MySql/Jpa?
In my web application, I have 3 tables: TAB A: Recipes (id, name) TAB B: Recipes_Ingredients(id, fk_recipe,fk_ingredient, quantity) Bridge table TAB C: Ingredients (id, name) I need to find all the recipes(TAB A) that containing a provided list of ingredients (TAB C). Es: I provide a list of ingredients id like 111 (spaghetti), 222(pepper), 333(oil) and I need to find
SQL Divide previous row balance by current row balance and insert that value into current rows column “Growth”
I have a table where like this. Year ProcessDate Month Balance RowNum Calculation 2022 20220430 4 22855547 1 2022 20220330 3 22644455 2 2022 20220230 2 22588666 3 2022 20220130 1 33545444 4 2022 20221230 12 22466666 5 I need to take the previous row of each column and divide that amount by the current row. Ex: Row 1 calculation
SQL Count each occurence of words separated by comma
I have a column in a table with words separated by comma. I need to count each occurence of each word My column looks like : (‘a, b, c’), (‘a, b, d’), (‘b, c, d’), (‘a’), (‘a, c’); (fiddle at the bottom) Here is what I get : But here is what I expect Here is what I’ve done so
Nearest matching text search using the same table in ClickHouse
Insert Data I want get the nearest matching text for each path field using the same table I read this example, but in this case “clickhouse” isn’t a value of the same table… Answer You do understand that it’s a cross join and in case of 10 rows, it’s 100 ngramDistance calls ?
Delete operation is slow and rebuilding index doesn’t seems to solve the issue
I have a simple delete query : ImportLog table has around 3 million records with all log details. I have non clustered index created on ImportLog table on ImportLogID. The fragementation is less than 10% but still the query is taking more time to execute but when I rebuild the index manually it is executed within a second. After a
Oracle Date in Where Clause give me this error ORA-00932: inconsistent datatypes: expected NUMBER got DATE
sql request is: the type of DRCR_CR_DT is: DATE DRCR_CR_DT contain something like this : 1/4/2022 2:02:54 PM thank you for the answer Answer I’d expect something different; if date you provide is 1/4/2022, then there’s no mon format model in it: When fixed: If that’s not it, please, provide sample data (CREATE TABLE and INSERT INTO statements). [EDIT] This
How to display only results matching a certain condition in SQL?
I would appreciate your help very much as Iām still at beginner level in SQL. Thank you š I have tables representing counties, vendors and their respective sales of stationery products. I have to display only the counties where the sum of all sales exceeds 100 without counting vendor 2 (Randall). For these counties I need county name, vendor name
MS SQL Convert rows to columns with Pivot
in MS SQL I have following table I would like to convert it to : I had a look at pivot table function, but could not get it work correctly. Any advice? Answer You coud try this:
Using Variables Passing Into MSSQL Stored Proc as part of queries
I want to use the value from variables that is passed into the stored proc. Is that allow? For example, I want to pass CID=5,SID=4 Into an Update Stored Proc and it looks like this: In which is like “DELETE FROM [User54]” But I want to dynamically done given the parameter Can it be done and how is it done?