Skip to content
Advertisement

python function parameter control

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

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

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

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

Advertisement