How can I do GroupBy Multiple Columns in LINQ
Something as in SQL :
SELECT * FROM <TableName> GROUP BY <Column1>,<Column2>
How Can i convert below to LINQ
QuantityBreakdown
(
MaterialID int,
ProductID int,
Quantity float
)
INSERT INTO @QuantityBreakdown (MaterialID, ProductID, Quantity)
SELECT MaterialID, ProductID, SUM(Quantity)
FROM @Transactions
GROUP BY MaterialID, ProductID
Thanks
How do I get all of the "columns" using linq from this dictionary.
Dictionary<int, Dictionary<int, string>> _cells;
where I can access a row this way
var someRow = _cells[2];
There are so many methods out there and it's a bit confusing but what's the best way to change the default grid columns in the Magento 1.4 product catalog?
Thanks
I had a table (Some_Table) with two columns:
A B
-------------------
1 test
2 test
3 test1
4 test1
i would like to return DISTINCT values for column B and it's associated value in column A (first in distinct set), so something like this:
A B
-----------
1 test
3 test1
What is the sql?
right now I have this line, and it worked until I had whitespace in the second field.
svn status | grep '\!' | gawk '{print $2;}' > removedProjs
is there a way to have awk print everything in $2 or greater? ($3, $4.. until we don't have anymore columns?)
I suppose I should add that I'm doing this in a windows environment with cygwin.
I have a large table ( 10 million rows) which I am adding new columns and indexes to.
This is taking progressively longer and longer to complete.
I have a powerful server with 16GB of memory available.
What are the best settings in my.cnf to increase in order to speed this process up?
What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so:
INSERT INTO some_table (column1, column2, column3)
SELECT
Rows.n.value('(@column1)[1]', 'varchar(20)'),
Rows.n.value('(@column2)[1]', 'nvarchar(100)'),
Rows.n.value('(@column3)[1]', 'int'),
FROM @xml.nodes('//Rows') Rows(n)
However I find that this is getting very slow for even moderate size xml data.
Hi all,
Any idea on how to order the results of a MYSQL query by the sum of two columns rather than by a single column?
Select * FROM table ORDER BY (col1+col2) desc
I know that won't work., but I hope it conveys what I want to do fairly well.
Thanks!
Having five columns containing numeric values
A | B | C | D | E
-------------------
2 | 3 | 4 | 1 | 5
3 | 6 | 1 | 5 | 4
4 | 5 | 7 | 1 | 3
I want to obtain the concatenation of the values after sort them:
ABCDE
-----------
1 2 3 4 5
1 3 4 5 6
1 3 4 5 7
What is the best way to do it?
I have several values I'm rendering as elements on my template and I want to further this by having them arranged into equal (or near-equal columns) automatically in the template. How can I achieve this?
So far I'm rendering all the values as
<ul>
{% for feature in features %}
<li>{{ feature }}</li>
{% endfor %}
</ul>
Dim r as Range
Set r = Range("C2:D3")
Dim r1 as Range, r2 as Range
Set r1 = r.EntireColumn
Set r2 = r.Columns
Won't both ranges represent the range "C:D"? What is the difference between the two?
I need to sort a 2 dimensional array of doubles on multiple columns using either C or C++. Could someone point me to the algorithm that I should use or an existing library (perhaps boost?) that has this functionality?
I have a feeling that writing a recursive function may be the way to go but I am too lazy to write out the algorithm or implement it myself if it has been done elsewhere. :-)
Thanks
I have an excel spreadsheet that I want to import select columns into my database table. the wiz didn't offer that option.
any easy code options?
Thanks
newbie
What is a better way to program the following SQL:
str_to_date(
concat(convert(D.DAY, CHAR(2)),
'-',
convert(M.MONTH, CHAR(2)),
'-',
convert(M.YEAR, CHAR(4))),
'%e-%m-%Y' ) as AMOUNT_DATE
I want to convert the columns D.DAY, M.MONTH, and M.YEAR to a date field using MySQL. The above works, but seems much more complicated than it needs to be. (If there's an ANSI SQL way to do it, that would be even better.)
Thank you!
i need to implement the following query in SQL Server
select *
from table1
WHERE (CM_PLAN_ID,Individual_ID)
IN
(
Select CM_PLAN_ID, Individual_ID
From CRM_VCM_CURRENT_LEAD_STATUS
Where Lead_Key = :_Lead_Key
)
but the WHERE..IN clause allows only 1 column. How to compare 2 or more columns with another inner select?
I need a way to store an int for N columns. Basically what I have is this:
Armies:
ArmyID - UINT
UnitCount1 - UINT
UnitCount2 - UINT
UnitCount3 - UINT
UnitCount4 - UINT
...
I can't possible add a column for each and every unit, so I need a fast way to store the number of each units in an army (you might have guesses it's for a game by now). Using XML is not an option as it will be dead slow.
How can I setup some format for cells in some column in my DataTable or GridView ?
I need to make some double columns rounded , for example :
3.564643 - 3.56
3.546723 - 3.55
6.654644 - 6.65
thank you.
I have a XML with 3 values, they are 'name', 'department', 'value'. I want to display a data grid with four columns like Name, department, credit and debit. When I have a value positive in 'value' column I want to enter the value in debit column and 0 in credit column and vice versa.
I'm new to drupal and I have a question about views:
I'm building an employee directory and need to display the results in two columns, such as:
Record 1 Record 2
Record 3 Record 4
Record 5 Record 6
. . .
How can I accomplish this?
To take it one step further, I want each record formatted as:
IMAGE NAME
TITLE
I have no idea where to start. Any assistance is appreciated!
I'm looking to select columns 2-4 on the 2nd row in a table. Does jquery have any sort of "and" function in their selectors? Or would I have to do something like this?
$('#id tr:eq(1)').find('td:lt(5)').find('td:gt(1)')
Say that I have two CSV files (file1 and file2) with contents as shown below:
file1:
fred,43,Male,"23,45",blue,"1, bedrock avenue"
file2:
fred,39,Male,"23,45",blue,"1, bedrock avenue"
I would like to compare these two CSV records to see if columns 0,2,3,4, and 5 are the same. I don't care about column 1.
What's the most pythonic way of doing this?
EDIT:
Some example code would be appreciated.
Hi,
It is probably pretty simple but I cannot figure it out: Say I have tables A and B both with the same columns. I need to do SELECT * FROM A,B without having results merged into one row.
I.e. when each table has 2 rows, I need the result to have 4 rows.
EDIT: I know about JOIN but dont know how to join the tables without predicate. I need merge them.
Thanks
I want to design following scenario
Base class (Id, Name, order, Value)
3 Derived classes derive1, derive2, derive3 inheriting properties from base
There is no table for base class. And 1 table for each derived class. 3 tables have same columns.
How can I create mapping file ignoring base class?
Do I need to create 1 mapping file for each derived class? can I achieve this using only 1 mapping file?