I have an example table with Ids and Names, I would like to get a new table with unique Ids and the names of one column combined (grouped by ID). My data looks like this (SQL Server 2017 & 2019 – SSMS): My goal is to get the following output with a qry: Does anybody has a tip/suggestion how to
Tag: sql
FromSqlRaw injection EF Core 3.0
I am wondering how safe the fromSqlRaw method is. I am doing the following in my code, where the person id is a parameter from the method itself: Is this code safe to SQL injection? And is there other security vulnerabilities that I should know of when using this? Answer Use proper parametrization for your in…
sql deleting duplicate row
I have a table in SQL i want only one owner_id i don’t want 100 multiple times, but i want amount of all owner_id 100 i,e that amount should be added(i,e. 1000+3000+12000) if i delete duplicate Owner_id row. how to do it And one more issue that owner_id from another table, how to get Owner name from ano…
DB | Postgres | How to check if IP is in a list of IPs or a range
I have a table that has a TEXT column that holds IP, IPs or range (for example 1.1.1.1/24). In case of multiple IPs, the IPs will be separated by a @##@ for example 1.1.1.1@##@2.2.2.2 The table with 4 rows: I want to get all the rows that contain the ip 1.1.1.1 or 3.3.3.3, meaning I want to get the first
SQL SELECT from based on truth table
How can I select the columns to be returned by a lookup truth table? my data: | nam | X | Y | | Bob | 2 | 5 | | Jan | 1 | 6 | the lookup table | prop| SHOW | | nam | true | | X | false| | Y | …
How can I create a SQL Server stored procedure which can produce a table combining three tables
I have three SQL tables as below. Table #1: Benchmark WorkLoadType MaxUsersperVCpu vCPU RAM MaxUserCapacity ———————————————————— Light 6 …
SQL query to get rows contains value of another query
I have 2 tables transaction and query. Transaction table have unique tid and the query table has tid_(subtransactionid). I want to get the list of all subtransactions by using tid. I tried this Answer You can join the tables and use the operator LIKE in the ON clause: If your database does not support the fun…
Tables being queried with SQL and Sqlalchemy have same column names
I am querying a variety of different tables in a mysql database with sqlalchemy, and sql query code. My issue right now is renaming some of the columns being joined. The queries are all coming into …
Unable to create this MYSQL Trigger on PHPMYADMIN
I am trying to update a column ( called DateModified ) before update happens on the table row. so here is my trigger: CREATE TRIGGER `date_mod_category` BEFORE UPDATE ON `categories` FOR EACH ROW …
Error converting data type nvarchar to numeric convert/cast
I suspect this has to do with reporting ClientName, which is a nvarchar data type. AUMid is nchar. I’m not sure how to work around this without changing the data types (which I prefer not to). I need to display Clients.ClientName. It is linked to the AUM table via AUM.AUMid. Removing SUM(AUM.AUM * AUM.M…