I have a function called “getBooks”, and this function is actually a combination of 2 functions. one function must work without taking the ‘name’ parameter, the other must work by taking the ‘name’ parameter because i have to change the sql template according to the ‘name’ parameter. how can i provide that? Answer You can specify a default parameter of
In case expression else part is not getting executed and giving wrong output
I have two tables one for transactional and the other one is a reference table. I need to get the output based on columns col_ans and col_pos_id and need to fetch the value from the reference table as per the below requirement. I need to check col_id equals 7 only. And all operation needs to happen on this col_id only.
fill in missing dates of date_trunc with last row data
I currently have a query for chart using date_trunc and the result is something like this dates with no value are skipped , however I need it to be like this notice how for 7th and 8th it will use the last available data which is in 6th. Will appreciate any help! Answer Use generate_series to generate a row for
Option to leave part of a searchable report/form blank in Microsoft access
I have a query in MS Access that is linked to a searchable report which is linked to a form. Part of the report ask users to include two reasons that will be used as criteria for a query. Currently, the report (screenshot) below does not allow for users to simply enter in 1 reason. Users must enter in 2
SQL conditions with COUNT in select query
In the following SQL query, I want to display if factor count is greater than one select NULL else return factor. However, I get this error: EDITED It is working fine if we use it as follows, however, I need to use factor in else part and Null in IF part Answer You can’t use COUNT(factor) and factor in one
Creating a VIEW to remove duplicates from table based on max date
I have a table that appends data each day and records the imported date, however it appends duplicates. My end goal here is to remove the duplicates based on the lowest imported column date. Here would be the initial state of that table: TABLE CLIENTS Name Surname Imported Bob John 18-07-2022 Marta White 18-07-2022 Ryan Max 18-07-2022 Bob John 20-07-2022
join equal or max
I want to join two tables by ‘EmployeeId’ and ‘CalendarMonthId’, but problem is that I want to connect record with the bigest CalednarMonthId if not exist equal. I use Azure Synapse SQL pool. Example data and code Base on this data I have problem with connect table: emp_contr, row: EmployeeId:1, CalendarMonthId:202205 with row from table contr from the same user
SQL divide row by row with the same column by using CASE
I want to create a new column which is to calculate the percentage, I know it can use subquery to do that, but is it possible to use CASE to do this? If using CASE how is the logic? Column A Column B Column C New Column that i want to create 2022-01-01 M0 72 72 * 100 / 72
Extract month from number of days in a year
I am trying to extract month from number of day in year in Oracle SQL, for instance day 32 is february. I do not have permission to use procedure, so I have to do it just using select. Any help? Answer You get to the solution as follows. First convert the day X into a date and extract the month
Search a word inside post_content specifically on H1 tag [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 months ago. Improve this question As Title implies, Search the value inside the variable of $word inside the tag of column post_title content. The query should view the data of