table_1 shows the aggregation of the revenue by different geographies I would like to disaggregate the 3d period to daily: table_2 as a next step, I would like to also change the table_2 format into table_3: From table_1 to table_2, I am not sure. From table_2 to table_3, I am thinking of: With the code above…
Tag: sql
i have birthdate in the table , i need to find age between 30 to 70 how can I write sql query for that? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 12 months ago. Improve this question begin age and end age find where age is between 30 to 70 i just have bir…
If a meta_key has a meta_value, update the meta_key name
In a table called wp_postmeta, there are ~1K meta_key’s called _wcj_custom_product_tabs_content_local_1, but only ~100 have a meta_value. What I need to do is update the meta_key name, but only for the meta_key’s that actually have a meta_value. I can select all the meta_key’s that are not e…
Update with a subquery and a join
How do I update table1 with results of this query – I want to do something like this – Answer This question has been answered many times in SO… anyway, the query should be built this way One option Other option Surely there are other additional ways…
SQL WHERE statement returning both or conditions
I’m trying to return a single row based on this where statement The issue is I have to get a row based on multiple criteria and the more that match determines the final match. The statement above returns a row just fine if it matches the bottom or statement, but if it matches the first OR it returns res…
How do I join two tables based on a minimum value in the first table?
I have two tables: one has a list of weather stations near major cities and the distance to the city, and the other has weather averages for each weather station. I want to do a join such as showing weather data from the station closest to San Francisco. Example table distances: Example table weatherdata I…
Split column value by semicolon into individual rows based on another column’s value
I need to generate rows based on the quantity value. The barcode column will have value separate by semicolon “;” I want to turn each separated value into individual column. If the barcode value is less than the quantity, other rows of barcode column will be null. The barcode value will not be mor…
Use SSIS expresion to break up Full Name in to Seperate fields, Last First Middle
I have a full name field that has data in the format of Last Name First Name Middle Name some of the data doesn’t have a Middle Name where as it will be just Last Name First Name also some of the data has 2 spaces between the Last Name and First Name where as it comes to be Last
InfluxQL: tag called Group causing grief
I have to work with an influxDB database and one of the tags is called Group. For example the query select * from Testing limit 10 returns The problem is when I try to have a rule based on group, e.g. I get an error that says ERR: error parsing query: found GROUP, expected identifier, string, number, bool at …
Want to run a query multiple times using a for loop and add each result into a dictionary. This code only execute once even as it loops through
I have a query that take a random sample of records. I want to do this multiple times and add each result into a dictionary, which I will concat into a pandas DataFrame later. This code only execute once even as it loops through. Answer cursor.fetchall() doesn’t execute the query, it just fetches the re…