I'm trying to migrate a MySQL-based app over to Microsoft SQL Server 2005 (not by choice, but that's life). In the original app, we used almost entirely ANSI-SQL compliant statements, with one signif...
How do I get: id Name Value 1 A 4 1 B 8 2 C 9 to id Column 1 A:4, B:8 2 C:9
I know that in sql server we cannot use Group_concat function but here is one issue i have in which i need to Group_Concat my query.I google it found some logic but not able to correct it.My sql query...
I need to write a sql query on the table such that the result would have the group by column along with the aggregated column with comma separators. My table would be in the below format |```````...
I want to create a table valued function in SQL Server, which I want to return data in comma separated values. For example table: tbl ID | Value ---+------- 1 | 100 1 | 200 1 | 300 1 | 400 ...
I have the following query: SELECT Account, Unit, SUM(state_fee), Code FROM tblMta WHERE MTA.Id = '123' GROUP BY Account,Unit This of course throws an exception because the Code is not in t...
I currently have a SQL query that returns a number of fields. I need one f the fields to be effectively a sub query sub that. The Problem in detail: If I have a table X with two columns, ModuleID...
I have 2 tables: SELECT UnitId FROM dbo.tblUnits SELECT UnitId, WorkOrderNumber FROM dbo.tblWorkOrders I need to display all UnitId's from dbo.tblUnits then in 1 column diplay all the WorkOrders s...
Suppose I have this table [Table1] Name Mark ------- ------ ABC 10 DEF 10 GHI 10 JKL 20 MNO 20 PQR 30 What should be my SQL statement to retrieve a record that looks like...
I'm using Microsoft SQL Server 2005. I think I need a sub-query. I'm looking for one (1) row per customer, with the AvailableAction field be a concatenation of all the Actions for each customer. us...