max

Setting maxlength for each row in a multiline texbox

I want to set maxlength to 5 characters for each row in a mulitiline textbox. ...

how to do a select max in django

I have a list of objects how can I run a query to give the max value of a field: I'm using this code: def get_best_argument(self): try: arg = self.argument_set.order_by('-rating')[0].details except IndexError: return 'no posts' return arg rating is an integer ...

Cumulative Maximum, calculate for every parent record

Have anyone used the Cumulative Maximum functoid and noticed performance problems? Abstract If one wants to map the maximum value of a field you can use the functoid Cumulative Maximum. Problem After we had used it for a while we noticed degraded performance on larger files. Examining the xslt one notices that the max calculation is m...

MYSQL shows incorrect rows when using GROUP BY

I have two tables: article('id', 'ticket_id', 'incoming_time', 'to', 'from', 'message') ticket('id', 'queue_id') where tickets represent a thread of emails between support staff and customers, and articles are the individual messages that compose a thread. I'm looking to find the article with the highest incoming time (expressed as ...

SQL MAX() question

uid timestamp 1 1242420497 1 1243534661 1 1243534858 1 1243611312 1 1243611511 3 1244817764 3 1244819093 1 1244749446 I have this table, and I am lookng to grab the row that has the highest time stamp. I tried using SELECT uid,max(timestamp) FROM `node_revisions` WHERE nid=51 but that returned uid timestamp 1 1244819...

Why is BIGInteger in JAVA not responding for higher powers?

Hi, When I try to find the value of BigInteger data type for 2 to power 23,000, I am not able to see the value. Upto 2 to power 22000, I could display the biginteger value . I am on XP. Any solution/suggestion? Sastry ...

How to get Max String Length in every Column of a Datatable

I have a DataTable object. Every column is of type string. Using LINQ, how can I get the maximum string length for every column? ...

Select Max in Linq to Entities / Entity SQL with type conversion

Hey everyone, I'm trying to create some CRUD functionality for a legacy database and using the Entity Framework as an ORM tool. One table, 'Sites', has a Guid type 'Id' column which is never seen by the users and an integer type 'SiteId' which the users use to identitfy a Site. For god knows what reason the numeric SiteId column is of ...

LINQ: How to perform .Max() on a property of all objects in a collection and return the object with maximum value

Hi, I have a list of objects that have to int properties. The list is the output of anothre linq query. The object: public class DimensionPair { public int Height { get; set; } public int Width { get; set; } I want find and return the object in the list which has the largest Height property value. I can manage to get the high...

sql server count of max values without subquery

I want to write a T-SQL query which returns not only the maximum value, but the number of rows having the maximum value. There must be a better way than what I have come up with --wrong way select LibraryBranchId, max(daysCheckedOut), count(daysCheckedOut) from books group by LibraryBranchId LibraryBranchId Expr1 Expr2 -...

How can I use MAX and LIMIT together in MySQL

I have a table with the following structure: ID | Color 1 | red 2 | blue 3 | yellow 8 | purple 10| green . . . 100|yellow I would like to be able to grab the MAX ID value for the first 5 rows. For example, I would like to do something like so: Select MAX(ID) From Table LIMIT 5 Hoping this would return the value 10 But, MySQL ke...

Bringing back only one row in a joined table using MS Access

Hi All I know there are similar postings out there, but when I have tried to use any of them in my own query I can not get it working. Basically, I have 3 tables that I want to query in ACCESS using the SQL view. Initially though and for this example I am trying to do it with just the 2. tb1 name: Tasks tb1 fields wanted: Task ID Ta...

Finding a reasonable (noise-free) maximum element in a vector

Consider a vector V riddled with noisy elements. What would be the fastest (or any) way to find a reasonable maximum element? For e.g., V = [1 2 3 4 100 1000] rmax = 4; I was thinking of sorting the elements and finding the second differential {i.e. diff(diff(unique(V)))}. EDIT: Sorry about the delay. I can't post any representati...

python to find longest word

how determine the longest word? First word, ok 'a aa aaa aa'[:'a aa aaa aa'.find(' ',1,10)] 'a' rfind is another subset 'a aa aaa aa'[:'a aa aaa aa'.rfind(' ',1,10)] 'a aa aaa' One row should be able. It's a direct word 'a aa aaa...' and can be a variable, no problem it occurs twice still naturally easier if also occured just once....

Countdown available spaces in a textarea with jquery or other?

I have a few areas on my site where I need to limit text input to X amount of characters and it's nice to show a number of spaces left while a user types in, like twitter does. I found this jquery plugin; jquery max-length plugin It does just what I need but it seems kind of like overkill, I am not sure the filesize but it looks like a...

Selecting "latest" row (up to a date) from a table (Sql Server 2008)

I have quite a few stored procedures following the pattern of selecting the row for which a date column is the latest up to a certain date, inclusive. I see two forms in use: select top 1 x, y, z from sometable where a=b and date <= @date order by date desc or select x, y, z from sometable where a=b and date=(select max(date) from so...

translate stored procedure - to Linq2SQL (count, max, group, orderby)

I've two tables (1:N) CREATE TABLE master (idMaster int identity (1,1) not null, TheName varchar( 100) null, constraint pk_master primary key(idMaster) clustered) and - CREATE TABLE lnk (idSlave int not null, idMaster int not null, constraint pk_lnk_master_slave(idSlave) primary key clustered) link between Master.idMaster and ...

Return record with max date

Table – Employee.Status.XREF Client Employee Date 198 Jon Doe 3/1/2009 198 Jon Doe 1/1/2009 Table – Employee.Status.History Client Employee Date Status 198 Jon Doe 5/21/2009 T 198 Jon Doe 3/1/2009 A 198 Jon Doe 1/1/2009 P Only query records in both Employee.Status.History and Employee.Status.XREF where Client, Employe...

SQL Group by & Max

Hello, I have a following data in a table: id name alarmId alarmUnit alarmLevel 1 test voltage psu warning 2 test voltage psu ceasing 3 test voltage psu warning 4 test temp rcc warning 5 test temp rcc ceasing I'd like to show only the most recent information about every colums group (alarmId,alarmUnit), so the result ...

MySQL : selecting all corresponding fields using MAX and GROUP BY

I have this table : And I would like to make a request that would return for each deal_id the row with the highest timestamp, and the corresponding status_id. So for this example, I would have returned 2 rows : 1226, 3, 2009-08-18 12:10:25 1227, 2, 2009-08-17 14:31:25 I tried to do it with this query SELECT deal_id, status_id, ma...