I have two tables: TABLE 1 TABLE 2 I need the rows from Table 1 where i can have ALL values from table 2. The values from table 2 are dynamic, so i need to create a procedure to search for these possible values. My output should be in that example: Answer You can do this by doing a join
Tag: split
Split Row and Paste to Different Tables Based on Column
I have a table like this. Table is populated each time an order is complete. One order can have one or many compartments. Please help write an SQL script that takes the above and splits it into two new tables like so: Table 1 Table 2 I’ve tried using the DISTINCT command as suggested; Which returns the error; Subquery returned
Is there a way to split text from cell into multiple records in SQL using line break delimiter?
I have a system generated report that exports all expense reports for a given period. All employees attached to the report are exported in one field “Attendees”, separating multiple employees with line breaks. I would like to break the cell into multiple records, still including the expense report NO. on each record. Note, the names in the attendee field are
Split SQL string with specific string instead of separator?
I have table that looks like: I want to split the string to this: My goal is to show ID and all the strings starting with 1 with just the next number after them. I filtered all rows without ‘%1,%’ and I don’t know how to continue. Answer If you use SQL Server 2016+, you may try to use a
Split String and Count Teradata SQL
I would like to split column ‘ASPCT_VLU_NM’ and count of occurrences of the timestamps in a given time frame. For example return the ID which have more than 3 occurrence in between 1537160520286 and 1537190520286. In the example below those are the timestamps : Answer If you are using Teradata 14 or later, then you may take advantage of the
Extract substring address SQL
I have a table with column Address which is like city. City_Name, citysector. CitySector, Street. Street_Name, StreetNumber. Street_Number EXAMPLE Address c. Paris, s. ParisDowntown, str. Rue Étienne Marcel, nr. 50 How can I substract 4 different columns like city, sector, street, streetNumber from Address column? Thanks in advance! Answer With a couple of replaces you can change your string format
How to retreive one single value in comma separated columns form, from a table in sql server?
I have a column with values like the one below. I need to separate value number 10 from each row in SQL sever (being value 1 the first one in the string, second after the first comma and so on). …
Filter msdb.dbo.sysjobsteps.command into seperate columns
I am trying to split the msdb.dbo.sysjobsteps.command column into separate columns to show the following information: folder project dtx package A small sample of my data is below: I have tried to use the substring method, however I cannot seem to get the starting and ending number of the substring. My aim is for the following in a ssms table:
Is there a way to write an insert statement with string_split which ignores duplicates?
I am trying to insert rows into a table using string_split command. It works fine if there are no duplicates. However, if there are duplicates, it errors out. I would like to know how to modify the …
Escape single quotes from comma separated string in Oracle
I am trying to escape single quotes from the comma separated string in Oracle SQL Developer, below is my Select query: SELECT (CASE WHEN PS.SUPPLIER_NO IS NULL THEN ‘FALSE’ ELSE ‘TRUE’ END) AS “Check”…