max

Is there a Max function in SQL Server that takes two values like Math.Max in .NET?

I want to write a query like this: SELECT o.OrderId, MAX(o.NegotiatedPrice, o.SuggestedPrice) FROM Order o But this isn't how the MAX function works, right? It is an aggregate function so it expects a single parameter and then returns the MAX of all rows. Does anyone know how to do it my way? ...

Change min/max/close buttons theme

Hi, im currently overiding the WM_NCPAINT, WM_NCCALCSIZE and WM_NCACTIVATE to paint my own color/themed title bar for an application im working on. Now this is working great however the min, max and close buttons still are xp default theme. I looked into what controls them and the mouse messages do. However they also contol resizing and...

Max of Sum in SQL

I have a list of stores, departments within the stores, and sales for each department, like so (created using max(sales) in a subquery, but that's not terribly important here I don't think): toronto baskets 500 vancouver baskets 350 halifax baskets 100 toronto noodles 275 vancouver noodles 390 halifax noodles 120 halifax ...

MySQL query for max() of all columns

Hello, What is the correct way of retrieving maximum values of all columns in a table with a single query? Thanks. Clarification: the same query should work on any table, i.e. the column names are not to be hard-coded into it. ...

wcf max message size

hey guys, a WCF question for you here: i have two services and am sending pretty chunky messages between them (~100kb). Though the previously mentioned value is typical of the size of the message, it is possible for it to fluctuate greatly (in both positive and negative directions). Thus, to deal with such situations where i have to tr...

Maximum length of a valid email id

What is the maximum length of a valid email id ...

Selecting the distinct values from three columns with the max of a fourth where there are duplicates

I have a table with one numeric value (n) and three string values (a,b,c). How do I query this table so that I get only distinct values of (a,b,c) and if there are duplicates, take the maximum of the corresponding set of n values? ...

Passing JSON strings larger than 80 characters

I'm having a problem passing strings that exceed 80 characters in JSON. When I pass a string that's exactly 80 characters long it works like magic. But once I add the 81st letter it craps out. I've tried looking at the json object in firebug and it seems to think the string is an array because it has an expander next to it. Clicking the ...

Getting Distinct records with date field?

Hello, I have a query where i want to get a distinct description by the latest date entered and the descriptions ID. I can get the disctinct part but i run into trouble with trying to get the ID since im using MAX on the date. Here is the query: SELECT DISTINCT Resource.Description, MAX(arq.DateReferred) AS DateReferred, arq.Assessment...

SSRS - OutOf MemoryException - is there a limit to the number of rows that can be displayed

I have created an rdl doc that points at a proc that returns 90 000 rows and I am getting an out of memory exception. Is there a limit to how many rows the report projects can handle? Currently I have changed the proc that drives my report to just do a select Top 90 000. My specs are to be able to create a report with 120 000 rows. M...

Anti-aliasing: Preferred ways of determing maximum frequency?

I've been reading up a bit on anti-aliasing and it seems to make sense, but there is one thing I'm not too sure of. How exactly do you find the maximum frequency of a signal (in the context of graphics). I realize there's more than one case so I assume there is more than one answer. But first let me state a simple algorithm that I think...

SQL MAX of column including its primary key

Short: From below sql select I get the cart_id and the value of the maximum valued item in that cart. select CartItems.cart_id, max(ItemValues.value) from CartItems inner join ItemValues on CartItems.item_id=ItemValues.item_id group by CartItems.cart_id but I also need item_id for that item (ItemValues.item-id). Long: Two tables, C...

How can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?

My table is: id home datetime player resource ---|-----|------------|--------|--------- 1 | 10 | 04/03/2009 | john | 399 2 | 11 | 04/03/2009 | juliet | 244 5 | 12 | 04/03/2009 | borat | 555 3 | 10 | 03/03/2009 | john | 300 4 | 11 | 03/03/2009 | juliet | 200 6 | 12 | 03/03...

How to find the top several values from an array?

I have an array of float values and want the value and more importantly the position of the maximum four values. I built the system originally to walk through the array and find the max the usual way, by comparing the value at the current position to a recorded max-so-far, and updating a position variable when the max-so-far changes. T...

CSS Div stretch 100% page height

I have a navigation bar on the left hand side of my page, and I want it to stretch to 100% of the page height. Not just the height of the viewport, but including the areas hidden until you scroll. I don't want to use javascript to accomplish this. Can it be done in HTML/CSS? ...

Min/Max Width in IE6 without javascript?

Is it possible to get min/max width working in IE6 without the use of javascript? On a somewhat related note, does Google Chrome not understand, <!--[if IE 6]><!--> <!--<![endif]--> or am I just screwing up that code. Thanks. ...

Simple Query to Grab Max Value for each ID

OK I have a table like this: ID Signal Station OwnerID 111 -120 Home 1 111 -130 Car 1 111 -135 Work 2 222 -98 Home 2 222 -95 Work 1 222 -103 Work 2 This is all for the same day. I just need the Query to return the max signal for each...

Mysql Max query

I have two tables : teachers (teacher_id,teacher_name) courses (teacher_id,course_id) And I need to display names of the teachers, teaching maximum number of courses : mysql> select teachers.teacher_name,tmp1.teacher_id,tmp1.cnt from (select max(tm p.cnt) as tmpMax from (select teacher_id,count(teacher_id) as cnt from courses g rou...

MySQL Help: SELECT table2.id WHERE ... table1.date is largest

I have 2 tables, using an inner join to query them. SELECT COUNT(table2.id) FROM table2 INNER JOIN table1 ON table2.relazioneid = table1.id WHERE table1.date > ? AND table1.date < ? It counts the ids of entries on reports between 2 dates. Table 1 holds info on the reports (date, groupid etc), table2 holds the entries on the reports...

SQL: finding double entries without losing the ID

I have 1 table "Products" that looks like this: ID Product Shop Color 01 Car A Black 02 Car B Black 03 Bike C Red 04 Plane A Silver 05 Car C Black 06 Bike A Red In this example, a Product always has the same color, independent ...