Skip to content

Tag: sql

(SQL) Pulling linked profiles from two tables using Knex

I currently have two tables with the following data: I currently have my query set up like this with Knex: I’m currently parsing the data into the following format: This works totally fine except for the cases where the parent has no children, as it won’t pull any data at all, including parent inf…

How do I return NULL conditionally from a JSON_QUERY

How do I return a JSON_QUERY that returns NULL (or no property at all) if the selected value from the sub-query (or left join) is empty? Here is a simple example (imagine NULL below is a sub-query): This returns and empty JSON object – which is not what I want: Since NULL is being returned from the sub-…

MYSQL no duplicate of 2 values

I couldn’t find an answer for this exact question although I am sure the information is on here somewhere. I have a python script that is adding stock data into a database. For each stock database has ~1000 lines where ‘ticker’ is the stock name and ‘time’ is the date(1 for each …