Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year. Improve this question In a big data scenario, where a piece of code has to run tens of thousa…
Tag: sql
SQL – Get the MAX COUNT access peak having only entrance and exit date
I have a table that keeps the access to our system, and it have two columns called entranceTime and exitTime Eg: What im trying to get is the “peak” of simultaneous connections, i tried using a subquery with MAX and COUNT like this: But with this query im getting the count of 5 instad of 3, is it …
Custom field in multiple selection
I’ve started WordPress 1 month ago and i’ve just done my first hook into the website (just to add/remove an estimated delivery date). Once i’ve had this I was thinking that I’ve broke the website (LMAO) but it was just a postmeta problem. The postmeta value just need to be added on on …
Joining another tables results to add to a existing query
I want to add RuntimePercentage column to my existing Uptime query for a report. Below is the current queries I use now. To do this I need to join another table results to make it happen but I haven’t been able to find a solution. The where clause gives me a error because UptimeMin is only in table a. H…
Generate Result based on max count in secondary column after a join
I have two tables which have a common key between them, and quite a lot of other important infos ; for the sake of simplicity i will be using Combination A and Combination B. When a combination is met, whichever table has the maximum number of records should be the source where i collect the information ; in …
PostgreSql format jsonb array
Can not find a proper query to format jsonb output in postgres I have a jonb column in a table. How do I select the posts column to have just certain fields? Something like: Any ideas? PS: The version of postgres is the latest 12, 13, 14 … Answer You may considering using json_to_record_set to extract y…
How to parse a list within a table in Snowflake using SQL
So I have a table as such: I would like to restructure this data so that each list element becomes its own row. If VALUE is an empty list, the expectation is it does not appear in the final dataset. Final result should be: I think using FLATTEN() in Snowflake should work here but I cant seem to get it.
Access alias in CASE statement
I am trying to create a column called DateStartedStatus that utilizes a previously aliased column to compute its value. It should use CurrentStatus to output a value and an error is showing that says “Invalid column name ‘CurrentStatus’”. How can I access that alias in the below case stateme…
On button click append OR… in SQL Query
Is it possible to append to an SQL query based on number of clicks on a button? Eg. For each time I click on the button (+) I want to add OR [PIN]=@LogID# Where # is a number increasing for everytime I press the plus (+) button. I also would like do be able to decrease the same way by
Oracle Case Statement and efficency
I have a piece of my Oracle Query i need to optimize a little line.quantity comes out from other part o query, for this example is not needed i think. I would like to calculate only once SUM(dnl.quantity) instead ad every iteraciotn, somethink like But obviously this give error at the second and 3rd WHEN Answ…