Android: Get highest value in column
I have an URL pointing to content and I need to get highest value contained in one of the columns. Is there any aggregate function that will accomplish that or do I have to do this manually? ...
I have an URL pointing to content and I need to get highest value contained in one of the columns. Is there any aggregate function that will accomplish that or do I have to do this manually? ...
I have a Sales table, with the following columns: employeeID amount date Now I want to SUM up the last 15 rows, so I am currently doing: SELECT TOP 15 SUM(amount) FROM Sales ORDER BY [Date] DESC But I get 15 rows obviously, is there a way I can sum it up and not have to loop through and SUM it on the client side? ...
I am trying to have a running average column in the SELECT statement based on a column from the n previous rows in the same SELECT statement. The average I need is based on the n previous rows in the resultset. Let me explain Id Number Average 1 1 NULL 2 3 NULL 3 2 ...
I have a query where I want to get distinct dates, the phone numbers associated with those dates, and a count of the phone numbers per date. For example, I have a database with dates and phone numbers and I want the result to be 9/2005 5554446666 3 9/2005 4445556666 1 10/2005 1112223333 1 11/2005 2223334444 ...
I'm curious about what be the best way to model this for optimized performance... not as concerned about real time data integrity I'll continue with the stackoverflow example Question id title Votes id user question A question has many votes For many queries however, we're only concerned with the aggregate number of votes ...
I am trying to aggregate movie times off of google/movies search into a usable format such as json or xml http://www.google.com/movies?q=movie+times&sc=1&mid=&hl=en&oi=showtimes&ct=change-location&near=new+york The Google AJAX api does not seem to work for this as you cannot do a movie search. Does anyone know ...
I have a table with 4 things I want... the Name, Price, QTY, and a specific Date There are lots of Entries per date: Name Price Date Twin Private $25 06/02/09 Double $35 06/02/09 Single $20 06/02/09 Twin Private $25 06/03/09 Double $35 06/03/09 Single $20 06/03/09 Twin Private ...
I have a the query: SELECT availables.bookdate AS Date, DATEDIFF(now(),availables.updated_at) as Age FROM availables INNER JOIN rooms ON availables.room_id=rooms.id WHERE availables.bookdate BETWEEN '2009-06-25' AND date_add('2009-06-25', INTERVAL 4 DAY) AND rooms.hostel_id = 5094 GROUP BY availables.bookdate Which returns something l...
I have a simple table with two columns (well two columns of interest, plus just an ID)... I have an ajax search which is just looking for keywords... which are then sent to my real search... the ajax search doesn't care what they are, but they need to be distinct... How can I merge the two columns together: City, Country Krakow, Polan...
Hi, I've the following code which is used to display ItemID, Name, and Price via SQLDATASOURCE. How is it possible to get the SUM of the values in the Price column and display it in the footer? <asp:GridView ID="GridView2" runat="server" ShowFooter="true" AutoGenerateColumns="False" DataKeyNames="ItemID" DataSourceID="SqlDataSource...
My application has a very simple model right now and I'm trying to find the best way to traverse through an aggregate. As you can see in my model diagram at the bottom, I have an account, a trip and a list of people attending a trip. I would like to be able to view all of the trips an account is apart of and I have come up with something...
Lets say I have this amputated Person class: class Person { public int Age { get; set; } public string Country { get; set; } public int SOReputation { get; set; } public TimeSpan TimeSpentOnSO { get; set; } ... } I can then group on Age and Country like this: var groups = aLis...
I have a collection of objects of one type that I'd like to convert to a different type. This can be done easily with foreach, but I'd like to figure out how to use Linq's aggregate function to do it. The problem is all the Aggregate examples use types line string or int, which support the '+' operator. I'd like to have the accumulato...
Hi there, Can anyone help with an aggregate function.. MIN. I have a car table that i want to return minimum sale price and minimum year on a tbale that has identical cars but different years and price ... Basically if i removed Registration (contains a YEAR) from the group by and select the query works but if i leave it in then i get...
Crazy question...however, I want the sum of all the rows in a table for a column (without using the group by clause) Example: Table = Survey Columns = Answer1, Answer2, Answer3 1 1 1 4 3 5 3 3 2 I want the sums for each column. Final results should look like: Ans...
I have the exact same question as this one: http://stackoverflow.com/questions/831519/aggregate-functions-in-ado-net-with-group-by-functionality/1084230 however the proposed solution was for .net 3.5 but I am using .Net 2.0 so I cant the LINQ query. To summarize: I have a DataSet and I want to create a view from it and apply something s...
I'm modeling a very basic ASP.NET MVC app using NHibernate and I seem to be stuck on my design. Here's a sketch of my model: As you can see this is VERY basic but I have some concerns about it. The User root entity and the Organization root entity are accessing the same Organization_Users entity child via two one-to-many relationship...
How can I count records with multiple constraints using django's aggregate functionality? Using django trunk I'm trying to replace a convoluted database-specific SQL statement with django aggregates. As an example, say I have a database structured with tables for blogs running on many domains (think .co.uk, .com, .etc), each taking many...
Is it okay to get a read-only collection from an aggregate without going through the root to get it? My model does some of this right now and I was wondering if that's an acceptable design. Thanks Edit: Here's an example I have an aggregate root entity called UserAccount and another aggregate root called VideoStore. Users can have mu...
I'm not sure if I'm missing something really obvious, but I keep getting a syntax error on this query. Even if I AM missing something obvious, I'd like to know if there is a smarter way of getting what I'm after. Basically, the query asks for any rows tied to a user with a start_date between Monday and Friday. That works great. But then...