In my database I have a table with consecutive dates. I group all dates to calendar weeks and display them in a table in my CSS. Now i want to display also the first and the last day of the calendar …
SQLite Insert Distinct from 2 variables
I have a SQLite DB with a table with the following kind of data: What I need to do is take columns B and C, create a single unduplicated list and autoincrement the primary key for the unique values. It needs to check to make sure an entry is not already existing – so the second table would be: I
Display group having certain value only on max date and not in other entries of group
I am looking to display the group which is grouped on id column where trans_cd=’Audit’ only on max trans_proc_dt of that group. There should not be any other trans_cd=’Audit’ execpt for max trans_proc_dt. My output should be I can’t think how to go about getting my result set. An…
How can I show values with zero in a Group By query
I am trying to get the zero values from my status table associated with the case of one user. So, I have this query that returns me only one value because, I have only one case associated with one status but I want to receive also the another status with value 0. So I have the status ‘Open’ and &#…
SQL Query creation with multiple joins
I am working with MYSQL, and want to create a query. I have 3 tables. QUESTION QUESTION_NUMBER QUESTION_DESCRIPTION 1 anydesc 2 anydesc2 ANSWER ANSWER_NUMBER ANSWER_DESCRIPTION 1 anydescANS 2 anydesc2ANS 3 anydesc3ANS And a bridge TABLE QUESTION_ANSWER Q_NUM A_NUM 1 1 2 2 2 3 Now I want to retrieve all the An…
SQL replace and insert Into
I have this table “NamesTable” in SQL Server. I want to insert and replace in a second column the corresponding name like this This is my query: The query runs and replace the selected words, but do not insert into my existing table. What I am doing wrong? Answer No idea what is the objective of y…
Is it a good idea to set the date in to a varchar in sql?
Later on Im going to count the record for every month in year
Bigquery replace value in a column based on previous year date condition
I need help to write a SQL logic in bigquery to replace a value in one column based on a condition as below FINANCIAL YEAR –> JUL to JUN How can I make it more dynamic so it rolls over next year Current: Version DATE ACT 202104 ACT 202101 ACT 202006 ACT 202001 ACT 202007 ACT 201903 ACT 202008 TAR
How to Further Group Items in a Column After Group By
I have an SQL table named “DATA” as follows: I’m attempting to return the following 3 columns: plan, planCount, totalCostPerPlan I’ve been working a query to return this and so far it looks like this: It sort of works, however, I get the data only partially grouped as follows: (The tab…
SQL Server CASE expression that does not result in waterfall
If I have a case expression is there a way it does not work as a waterfall? For example if I have the following dataset: Is there a way I can show the following results To show Right now it shows as Answer You can use a left join instead: