VB.NET - Query Doubt - Asked By sreya gopal on 02-Jun-13 04:54 AM

 CMD = New SqlCommand("update t set t.tb_TempSec_PreviousValue=I.G,from tb_TempSector t inner join(select tb_MainInv_ClntCode,sum(tb_MainInv_GrandTot)G,tb_MainInv_InvoiceType,tb_MainInv_MonYear from tb_Main_Invoicing  group by tb_MainInv_ClntCode,tb_MainInv_InvoiceType)as I on t.tb_TempSec_ClntCode =I.tb_MainInv_ClntCode and I.tb_MainInv_MonYear<'" & d & "' and I.tb_MainInv_InvoiceType is null", CON)



I want data to display based on  tb_MainInv_MonYear  ,but i dont want to group it .

How can i modify the code
Robbe Morris replied to sreya gopal on 02-Jun-13 11:21 AM
This is an update statement.  It won't "display" anything.

Hemanth Kumar replied to sreya gopal on 10-Jun-13 02:31 AM
Sreya ,

Please try to write your Query to a String variable as given below

string Query="update table set col1='hi' where col2=3";

First execute the Update Statement and select the Records based on your Conditions and bind the source to the grid.
Bill B replied to sreya gopal on 18-Jun-13 01:13 AM
look at Rozenshteing advanced SQL delta functions

why? what are they? it is simply a function to return 0 or 1

use sign function, Absolute value function

with such a combination you can make all that you need

it is more complicated for string fields, but can be done


1 - sgn( abs( somethingToMatch - fieldval ) )  = 1 , so it is included in the aggregate function

Look more for Rozenshtein delta functions. Very handy.