I have two tables as followed: Table A (with Column 1A and Column 2A) Table B (with Column 1B and Column 2B) I want to write a procedure that helps me do the following: Find matched rows of Table A …
How To Write A Query With A CTE And A Left Join
I am trying to have a calendar table with my CTE and set it up so that my dates in my query display like this Jan 18Jan 19Feb 18Feb 19 Now this is my DDL and this is the query I attempted, but in …
Postgres Function not working when I have a large result
I’m copying information from table 1(tmp_subtype) to table 2(subtype_user). I have a test table 1 with 15 registers. I run this function into postgres: CREATE OR REPLACE FUNCTION …
Trying to find the most recent date where a status field has changed in Oracle SQL
I have a table that shows a full history of location ID’s (LOCN_ID), which includes an ACTIVE_STATUS field showing A for active, or I for inactive. Each time a location’s active status changes, a new …
How to create a crosstab table of percentages bucketed into deciles in mysql
I’ve got the following table: SELECT key, Precision, Recall, F1_score, Accuracy FROM scores_table LIMIT 5; key Precision Recall F1_score Accuracy 2500004088-783 13.33 18.18 …
Maximizing query performance by joining with XML
While working on query performance optimisation, I noticed that the pattern below outperforms by a wide margin other, more obvious, ways of writing the same query. After looking at the execution plans, it appears this is due to parallelism. The table MyTable, has a clustered primary key on (Identifier, MyId, …
Multiple condition calculated column
I’m trying to figure out what’s the best approach for this: If C=”WORD”: A = 51 if B is between 0 and 2000 A = 102 if B is between 2001 and 8000 A = 204 if B is higher than 8000 …
Get several data from SQL query based on different conditions
I have the following code: SELECT DISTINCT m.solde_total_client ,c.client_nom ,co.contenant_nom FROM `mouvement` m, `client` c, `contenant` co WHERE c.client_id = m….
PDO union select results nothing
I need to select name, surname from users where username = column following inside network_follow table the query: “SELECT * FROM network_follow WHERE following = :f UNION SELECT name, surname FROM …
Posting Coordinates to Database from Google Maps API
Edit: I solved the problem. Leaving it up in case someone needs something similar in the future. I am trying to use google map api to get coordinates and save the information in a database. If the …