Table “Module” has these columns How to select distinct columns of ModuleGroupDisplayAs and ModuleGroup And After that, Add column on checking these distinct columns has particular UserID and CompanyID. That means I want to check condition that distinct columns has this particular userID and Compa…
Using SQLAdapter and SQLCommandBuilder without a Primary Key
I’m exploring the use of SqlCommandBuilder alongside Adapter.Update() to synchronize a DataGridView with an SQL Database table. I want to auto-generate SQL Update statements using SqlCommandBuilder….
PostgreSql Right Join From 3 Tables [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed las…
How to count and order correctly result from table
I have like this task currently: (sql fiddle: http://sqlfiddle.com/#!9/431723/49/0) It is necessary to form a SQL query to the files table which displays the number of files based on the success of the conversion and the presence of a good rating from registered / unregistered users. Output format: user_type …
Calculate distinct values per day that resets each month (Big Query)
If I have table like this that contains unique id of a store and the date when they make an order store_id order_date A 01-Jun-21 A 02-Jun-21 B 02-Jun-21 C 02-Jun-21 A 03-Jun-21 A 04-Jun-21 D 04-Jun-21 A 01-Jul-21 B 01-Jul-21 I need to aggregate it by day, but each day should only consist of store_id that nev…
Converting STUFF + FOR XML from SQL to Snowflake
I can’t quite figure out how to convert this to snowflake as I am still trying to learn it, is there a STUFF equivalent? Thanks Answer It is LISTAGG: STUFF + FOR XML is an old workaround used for version of SQL Server that does not support STRING_AGG natively. The Snwoflake equivalent is LISTAGG functio…
How to pull a related ‘anchor’ value on all recursive rows of a CTE
Using the following website as a starting point (https://www.sqlservertutorial.net/sql-server-basics/sql-server-recursive-cte/) , I have made a CTE query that looks like: WITH q (n, Part_Number, …
SQL Query for joining equivalent rows summing a column
I have two tables, articolo and saldo. articolo is like this: id desc_breve variante taglia 338673 ANYT229 00109 XL 338674 ANYT229 00109 XL 338675 ANYT229 00109 XXL 338711 MYP506S 00002 56 …
How to return multiple values from XML element in SQL?
I need to pull information from the “Name” element from an XML column in SQL. An example of the XML is below: <ArrayOfTarget xmlns:i="http://www.w3.org/2001/XMLSchema-instance" …
how to read a XML string value with leading space in sql server
I want to store the value of userId as ” XYZ” but when after executing the below code got output as “XYZ”. Want to store the value with leading space. Answer You may try to parse the input XML using a variable of XML data type and a combination of nodes() and value() methods: Using thi…