6
Answers

SQL Dynamic Query -DAM UEGRNT PLZZ HELP

Riddhi Valecha

Riddhi Valecha

10y
1.3k
1
Hi all..
I need help in - 1) SQL Query.
My requirement is -
I have to call  a method every 5 minutes and display the data on gridview in Windows Application.

I need help in forming the query.

I have a table as below -
ID Status Company Key Location 
 1 Error A V1 F
 2 Error B V1 G
 3 Success C V1 H
 4 Error D V2 I
 5 Error E V2 J

Now, once the Key hits success i.e. here V1 key gets success on ID-3. Hence, after the Key gets success, that key should not be picked again when the method is called on timer control.

V2 has not got success yet. Hence, it should be picked.

All the records, till the Key hits success should be picked. Once the Status is Success, then those keys should not be picked.

The output should be as follows -
 IDStatus Key Company Location 
 1Errior  V1 F
 2 ErrorV1  B G
 4 ErrorV2  D
 5Error  V2 J

After 5 minutes, when the method is called, only 2 records with ID-4 and 5 should be displayed.

This is because, V1 key have success on ID-3. Hence, that record should not be picked.

Please help me out...

This is urgent.

Answers (6)