c# - Max Value from a field as a condition -


i'm trying use max value of field condition delete several rows. in case it's numdoc.

i want check max value of it, i'm new sql , i'm not being able to. using c# , mysql, code have right this:

querystring = "delete wgcdoccab numdoc = max(numdoc) serie ='1' , tipodoc ='fss' , contribuinte ='999999990' ,  datadoc = convert(varchar(10),(dateadd(dd, -1, getdate())),120) "; 

this might newbie question , i'm sorry if case, answer, or whether there better way trying achieve.

edit: conditions deleting are: value serie must equal 1, tipo doc must equal fss , date, must of previous day, schema, deleting rows line line, fall condition thats why want use max can check fields 1 one do\while cycle

sorry if dont explain well, english not mother language.

assuming condition delete rows have maximum value of numdoc filtered other conditions,

delete  wgcdoccab  numdoc = (     select max(numdoc) wgcdoccab     serie ='1' , tipodoc ='fss' , contribuinte ='999999990' ,  datadoc = convert(varchar(10),(dateadd(dd, -1, getdate())), 120)) 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -