How Do I Write a SubSonic Select Statement that Sums Three Columns? -


I have to column SUM 3 and return values ​​in my result. What is the correct way to write it?

  SubSonic SQLQuery qs = New Subsonic Choose (). (Table ViewAllatings .Glo.Schema.TableName); SubSonic.Agregate ag = SubSonic.Aggregate.Sum (("Column 1 + Column 2 + Column 3)," Score "); q.Aggregates.Add (AG); String SqlResult = qs.BuildSqlStatement ();  In the form of 'score' in the form of total query like 

  SUM ("Column1 + Column2 + Column3"), in  

SqlResult See

But I also need other fields from my desk.

In that type of query, all the columns in your selection statement need to be the only object, just the total Together, change the type to group instead of group.

  SubSonic SQLQuery qs = new selection (new subosonic. Aggregate (new) "column 1 + column 2 + column 3", "score", aggregate function.SUM), // original new subsonic.Agretate (tablename.quel 4, aggregate work Group.), // Another column new subsonic Aggregate (table name column 5, Collected Working GroupBy) // Another column). (Table ViewAllratingsGlo.Schema.TableName);  

Comments

Popular posts from this blog

email - PHP mail error ... failed to open stream : permission denied -

c# - ListView onScroll event -

c - Linux mmap() error -