I am fairly new to SQL and having issues figuring out how to solve the simple issue below. I have a dataset I am trying to self-join, I am using (b.calendar_year_number -1) as one of the columns to join. I applied a calculation of -1 with the goal of trying to match values from the previous year. However, it …
How to get Ignite Cache SQL Query to Return Value Object
I have a Postgres database configured as my persistence layer and would like to execute SQL queries against the Postgres tables cached in Ignite. Ideally, I’d like to execute a query on these caches and be returned the Value objects represented by these tables. SqlQuery gives me the functionality that I…
SQL – Get value of column for rows matching a string AND a list of strings not found in the table?
I have a table that has (among other things) a “serial number” (VARCHAR(50)) column and an “active” (BOOLEAN) column… so a sample of data might look like this: Now, from an outside source, I am given a list of serial numbers, like so: Is there a single (ideally) query or series o…
Syntax error for nested condtionals in SQL
I’m pretty new to redshift and I’ve been trying to to do a nested case when condition here, yet I get a syntax error ERROR: syntax error at or near “)” in this line of SQL: I’m not sure what’s wrong, since I’m familiar with Python and I’m pretty sure this is how…
Average on most recent date for which data is available for multiple columns
I have a table (on BigQuery) that looks like the following: What I would like to get is the average score for each type but the average should be taken only on the most recent date for which at least one score is available for the type. From the example above, the aim is to obtain the following table in
Joining two tables to keep selected values and nulls
I have got two tables that I need to join. The second table is used to filter the records from the first table. table1.parameter table2.parameter; table2.parameter_group The result should include all records from table1 for a certain parameter_group but also records where the parameter is null. What I have is…
there is a way to order empty element like null element?
I need to order a column and there are a lot of elements null or empty.The problem is null element are ordered differente from null element The result about is that employees with name==null are the first position, after there are the elements with name!=null (are a real name) and at the end there are the ele…
In entity framework core, how we can set relationship for a table, when two fields is mapping to primary key of the another table
In entity framework core, how we can set relationship for a table, when two fields is mapping to primary key of the another table. For example I have two table namely Users & CashBox. Users Table Field Value UserId int UserName string CashBox Table Field Value CashBoxId int ActivatedBy int DeactivatedBy i…
How can I automatically add an additional apostrophe when entered by a user so as to not break their query?
I have a function where users specify start date (sd), end date (ed) and site in order to produce a graph. I have built a query that inputs the values entered accordingly; however, whenever site contains an apostrophe, it naturally breaks the query. In order to allow apostrophes within SQL queries, you must a…
Winforms, can I use a text box here instead of a combobox? (dropdown list with over 15k options)
For the last few weeks I’ve been building a product demo for work which includes a winform to enter new customer enquiry information. One of the form elements is a text box which, for the sake of ease, I haven’t imposed any validation on so far. However, I now need to make it so that the user can …