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…
need an additional column in SQL output
I have a table called product_info where there are two columns(product, product_id).There are 5 ‘product_id’ and 10 ‘product’. I wrote the following code to list products and their count.Now I need to create an additional column called ‘favorite_product’ if the ‘produ…
How do I select and count records less than 1 year old?
I’m using sqflite in my Flutter application. In this example, date is the actual date(10.06.2021) and DATUM is the datafield in the DB. I keep getting this syntax error: E/SQLiteLog(30657): (1) near “.2021”: syntax error in “SELECT COUNT (*) FROM Shisha_table WHERE (YEAR(10.06.2021) &#…
Customer/Material pair to count the occurences in the past 3 years and set the status flag. – aws redshift
I have a table with the following values date customer name material 9/1/2020 A A1 8/1/2019 A A2 8/1/2018 A A2 9/2/2020 B A1 9/2/2019 B A2 9/2/2017 B A2 So the output should be something like, if I could see a customer with a material, who has an entry in the past 3 years, then the status flag should
Oracle Apex – Case within a where statement
I’m having issues while running the following query (interactive report / simplified the query cause I’m sure the issue is with the case statement): The error is this one: ORA-20999. Does someone know why this is happening? (:p28 items are calculated via computations and work perfectly) Thanks! An…
How to query in sql with duplicate records?
Hi i have ITEAM A and ITEAM B table. For example Table 2) ITEAM B How to fetch records combined ITEAM A and ITEAM B with ascending order and duplicate records in sql? please help someone Answer
How to set an autoincrement composite primary key in oracle19c?
I want to create a table, with composite primary key and autoincrement, in Oracle 19c, like this: How I do it? Answer Create trigger on this table to achieve this result. Assume table name is test123
How to convert generic XML to a table row in PostgreSQL?
PostgresSQL v12.5 There is a table with single column containing strings formatted as XML. For simplicity let’s claim that there are no nesting: all tags inside <something> contain primitive values (strings). Assuming that there are much more elements than <a> and <b> inside, it would …