I have a table like this col1 col2 First row Second a First b Second row First c Second row The output required is like below: col1 col2 col3 First row 1 Second a 1 First b 1 Second row 2 First c 2 Second row 3 The logic is , whenever we are getting the value “row” in col2,
Change td content according to database
I have two table for assignments. TABLE1 has the data of the assignments posted by a faculty and TABLE2 has data of those students who submitted the assignments. Both table have one similar column called ‘assignment name’. My TABLE2 has a status column which is boolean data. By default i have set …
SQL: Conditional mean based on groups
Suppose I have a data like this I want to calculate the average of VALUE by Group ID, but conditional on VALUE being smaller or equal than the median by group. So for instance, for Group 1, the median is 4 and 2,3,4 are smaller or equal than 4, so it should give for group 1: Does anyone have a
Complex mysql query counting
I have 1 table name “companies” with several datas like : Id Owner Company Job 1 John Doe Company 1 CEO 1 John Doe Company 2 CEO 1 John Doe Company 3 CEO 1 Gab Durand Company 4 CEO 1 Rob Dujn Company 5 CTO 1 Alex DoeMorse Company 6 COO What I need is to get 1 line by
pgsql merge two json arrays
I have to select two type of result set from a table and merge them in single json array like Its saying syntax error I believe due to order by. I need to return this in json array so I am trying like this Its retiring two json arrays i.e. obvious, How can I make this in single array Thanks,
How to select columns on the basis of column names in Oracle
I tried the following, but that doesn’t work. Answer In this example, I’m composing a select statement based on list of columns from a table (passed to function as a parameter) whose name satisfies certain condition. As it is Scott’s emp table and its columns don’t have any suffix, I&#…
Create dynamic list of tables based on list with wildcards
So I have a list of tables that I want (with wildcards) That gives me Now what I need is a list of all tables mentioned in the table config.datalist So I want a list of: id 1) all tables in database TEST of which the schemaname starts with audit id 7) all tables in database TEST in the schema
Wrong data output on basic select condition
i’m trying to get the values which Dates bigger then 2021-07-17 and Cities starting with ‘G’. I have id in the PERSON table, id (references from PERSON(id)) and date in VACCDATA table, id (references from PERSON(id)) and city in ADDRESS table. While i only want the Row 2 (because it’s …
How to achieve generic Audit.NET json data processing?
I am using Audit.Net library to log EntityFramework actions into a database (currently everything into one AuditEventLogs table, where the JsonData column stores the data in the following Json format: Me and my team has a main aspect to achieve: Being able to create a search page where administrators are able…
Snowflake SQL Filter by transactions in the last rolling 30 days
I have a data table something similar to having a customer ID and an item purchase date as shown below. As a filter, I want to return customer ID IFF a given Customer ID has at least 1 purchase in the last 30 rolling days. Is this something that can be done with a simple WHERE clause ? For my