from XML column I wanna try get info. Every client have more that one contract_key in XML, im using split_part and strpos for get needed information : But problem is this function return the first match found: ID Key amountR AVGamount 2253545 1 10000 50 this client in same XML have more Contract_key: ID Key amountR AVGamount 2253545 5 70000
Laravel 9 – implode() and whereIn
Hello i’m using query builder in my laravel app. I’m trying to use the implode() method from query builder. So for example i expect a string composed from : ‘ 2,3,4… ‘ I have to use this string in next query where i use the raw query IN (‘value’, ‘value’) I’m trying to wrap those IDs in to single quotes
Get Substring between two characters in SQL Server query
I want to get the string between two characters in the following string: I want to get the text between the @ and the SPACE after the @ which results in user1, is there a way to do this? There could even be 2 or more @ which I will need to extract like here is a table-like example: Sample
Word unscrambler in MySQL
Let’s say I have the input string “Hello” I want to be able to retrieve these output words: hole, lol, eh, hell All the output words letters should be contained in the input string. How I should be able to achieve that? I’ve tried to use like: But this returns words such as: hi، loop,etc.. but I need the all
How to Get only number from string mysql
I have a column called Equipment in my table that contains something like this: store(2) I need to create a new column and select only the number from the text otherwise we put 1. Example: Thanks. Answer You can use the REGEXP_SUBSTR function for this.
How can I avoid “stringly typed” code in T-SQL?
Consider some code like I believe that the technical term for such poor code is “stringly typed”. The key issue in the above code is that decisions are being made based on a string output that the developer needs to type and consistently get correct. If anything goes wrong, the language will be incapable of throwing errors. In a traditional
SQL Server: show string majority
I am looking to make a query in SQL SERVER that will allow me to display in a grouping the string that appears in most cases. Not the amount, not the maximum, but the string that is displayed in most cases: colA colB colC A 10 ccc A 20 aaa A 35 bbb A 25 aaa A 10 aaa B
Find Multiple Substring from a String Using SQL
I have a column log. I need to extract values from that log column and make 4 new columns My table: Output I need: Answer If the string really always follows exactly that format, you can use something funky like this: Which gives: This abuses the PARSENAME function, which is meant to parse 4 part named objects (server_name.database_name.schema_name.object_name).
Removing rows based on a string in Snowflake (SQL)
Let’s say I had a table as follows: And what I want to do here is if an ID has a group and the same ID has the group-Direct, then the Direct row is removed. So what It should look like is: What happened? The only ones to change were ID = 001 and ID = 005. ID = 001
Need to add double quotes to SQL SERVER string values
I have integer values that are being passed from a parameter that needed to be input as a string and padded so that they are 7 digits. This will then be passed into another query. This codes sets @control_num as (‘0005675, 0045464, 0002323’). I need this to be passed as (“0005675”, “0045464”, “0002323”). I’ve looked at other examples on-line but