I need to get the fiscal year from getdate(). My fiscal year format should be if getdate is today(18/03/2022) then the fiscal year column should show ‘FY22’ I used the below query to get the fiscal year Query Used: enter image description here Answer Add 6 months to the date (getdate in your examp…
linq query to get possible combinations
I have table1 like funid reasonid 1 1 1 2 2 1 2 3 and users table(users will repeat) like below userid reasonid 10 1 10 2 11 1 12 3 13 1 13 3 how to write a query to get the users satisfying table 1 combination {1,2} and {1,3}, so as per the above data userid 10 and
How to unpack array as columns
I have a table that looks like this: date volume_info 2022-01-01 {“temple”: 18348, “benny”: 8524, “polly”: 1698, “sally”: 5860} 2022-01-02 {“temple”: 2000, “benny”: 1000, “polly”: 3904, “sally”: 1776, “benjam…
How can I view an earlier version of a table on a T-SQL server?
I’ve just done something very silly. In both the productive and development environments on our SSMS server, I’ve changed the wrong column in one table. I know exactly what rows have been changed, but not what their original values were. I did not use a transaction. Is there any way to view the hi…
How can I split a string into two based on a character inbetween using REGEXP_EXTRACT?
I need to split a string into two based on a character and I need to do this without using SPLIT command. What I have: string fruit=orange fruit=apple vegetable=onion What I need: splitstring1 splitstring2 fruit orange fruit apple vegetable onion How can I solve this with REGEXP_EXTRACT? Answer Consider the b…
SQL Server ‘AS’ alias unexpected syntax
I’ve come across following T-SQL today: that yields following result: The part that got me confused was d(c) While trying to understand what’s going on I’ve modified T-SQL into: which yields following result: It was clear that d & m are table reference while letters in brackets c & b…
All values from first column matching values in second column as well as not matching values from second column
userColumn permissionColumn user1 permission1 user1 permission2 user2 permission1 user3 permission1 user3 permission3 user4 permission1 As cited in the subject line, I need to fetch all those users who have permissions ‘permission1’ but at the same time, I have to make sure that it doesn’t h…
Count all records and output values once a condition is met [SQL]
I would like to count all customers and return the signup date for the 3rd customer who has signed up. Essentially evaluate the number of customers that signed up and once the count of customers that have signed up reaches 3 to return the signup date and the id of the 3rd customer sample table output table An…
woocommerce_tax_rates table missing from database, even though taxes are configured?
I have configured taxes in Woocommerce (with the plugin EU/UK VAT Compliance for WooCommerce). This plugin configures them inside Woocommerce, see screenshot (yes, the menu’s are in Swedish, but you get the point). So where are the taxes stored? The sql table woocommerce_tax_rates isn’t there, see…
Remove String and Symbols
I am trying to create a query to remove some varchar and symbols from a big string, basically a table will have a column with this format(the information comes from an API call): so the requirement is to take the main “column names” from the sample, so at the end the string will be like: this shou…