select

Algorithm: Find index of 2nd smallest element from an unknown array

I have been pondering about my homework question for a while. I welcome (and prefer) any suggestions or approach on how to attack this problem. Basically, I have an array A of size N. We do not know the elements but we know they are distinct. The only thing that I have is a person who will take two indices (i,j) in N. This person will t...

Getting the value and text from a selectbox in ColdFusion.

I have several values in a select box. Is it possible to get both the value and the text between the <option> tags when the form is submitted? <option value="413">Highland </option> <option value="414">Inverclyde </option> Alternatively I suppose I have to store the names in a table or array for retrieval but would be much easier if ...

SQL EXCEPT TOP 10 records in Desc order

I'm want pull all records except the TOP 10 in my statement but I keep running into problems when doing my ORDER BY in my subquery "Incorrect Syntax near the keyword ORDER" @ID INT as SELECT ComVID, VID, MID, Ucomment, UdateAdded, MemberId, UserName, Avatar FROM table.miComments JOIN table.mbrProfile2 ON MID = MemberId WHERE VID = @I...

Need help to highlight a specific cell of a table and unhighlight onother cell if highlighted.

So, I will explain a bit further. I have a table with different cells. What I need to do is that when the user clicks on the cell, that cell would change its class and highlight. That is working perfect. The thing is I need is to unhighlight that cell if another cell is clicked. All cells has the "unselected" class by default. When cl...

vb.net aspx How do I set a select back to the default select after it's been changed?

I need to set a select back to it's default value after it's been changed based on certain conditions. Any ideas? ...

add something to Jquery selection and format

Ok, so i'm trying to create an address out of some bits of code from another spot on the page. The code i'm trying to create the address from is this: <div class="adr"> <h3 class="name fn">Boardwalk Audi<div class="separator">|</div></h3> <h4 class="street street-address">5930 West Plano Pkwy</h4> <h4 class="city"> <span class=...

MySQL IN with LIKE

How would I use a IN table with like? So that I could use % in them? By in I mean: SELECT fields FROM table WHERE age = "50" AND name IN ("tim", "bob", "nancy", "john"); I already tried: SELECT fields FROM table WHERE age = "50" AND name LIKE ("2010-09-17%", "2010-09-16%") But it gave the error "Operand should...

Bulk select in Sybase

Hi, I have a few thousand col1, col2 distinct values. Col1 -> some primary key and Col 2 -> date. For a third col 3, i have to query a large table, which gives me only few hundred results in most cases. now my concern is how can write my where condition or use unions so that the number of times i am querying my DB decreases. my progra...

MySQL SELECT WHERE 'a' IN (`field`)

Hello, I know it is not an appropriate technique to have a structure of MySQL table as such, but I have to work with such. The problem is, that the field in table has value with comma seperated integers, like "1,3,5,7,10" and I want the query to return rows, in which field has a to the query passed number in it, like: SELECT * FROM `tab...

How to fetch lots of database table records by primary key?

Using the ADO.NET MySQL Connector, what is a good way to fetch lots of records (1000+) by primary key? I have a table with just a few small columns, and a VARCHAR(128) primary key. Currently it has about 100k entries, but this will become more in the future. In the beginning, I thought I would use the SQL IN statement: SELECT * FROM `...

Search Box - Selecting Data from Multiple Tables

In my application, I want to create a "universal search" box that will allow the users to perform a general search on any of the 'informational' data within the database. The system happens to be an account management system, so ideally they'd be able to do searches for e-mail addresses, usernames, ID's, etc. I've been searching around...

nHibernate Select statement for specific fields

I'm using nHibernate with c# to get a list of records or strings from the database as show in the first couple of lines of code below. This works fine. What I want to do is select a few specific fields from the record and not the entire record. I have tried various techniques and can't seem to find any examples on how to do this. Cou...

join multiple fields to one table

I have 2 tables (there are more but un related to question) optionValue and productStock I want to get the option names from the optionValue table for each option1, option2, option3 (the query below will should help to make more sense) below is my attempt, the current query it only works if all options are set but is returns null if a...

Complicated Sub-query - is this possible?

I've got 2 tables: one stores tags, the other stores articles. There's a mode "Get articles by tag", which basically takes all articles, tagged "x". In my articles table I use a filed, called Tags, that stores data in such pattern 'tag1, tag2, tag3, ...'. So I want to get everything work by just a single query like that: SELECT *, ...

MySQL - conditional SELECT

I have tables item and store (it's a store management system). item table has a column called store_id and another column called status. item.status can be 'sold' or 'unsold'. I need help writing a query which will do these things: select all items of all stores if a store has just one item and that item is 'sold', remove that item fr...

MySQL Select Multiple VALUES

Totally out of ideas here, could be needing a simple solution. Basically my desired query is : SELECT * FROM table WHERE id = 3,4 I want to select only the row which has ID 3 and 4, or maybe name "andy" and "paul" Thank you very much for the answer ...

How do I set the max number of items visible in a SELECT drop down?

Hi, I have a drop down list of around 30 items and I want to only show 8 items and then the drop down should scroll. I'm using MVC2 in VS2010 <%= Html.DropDownListFor(d => d.Thing.ThingID, Model.Things, new { style = "width: 200px", rows = 10 })%> ...

How to detect two identical i2c slaves but with different chip select with one linux i2c driver

Hi, I have to communicate with 2 identical i2c slaves that have a different chip select each. I would like to use one driver for both. What is the best way to do that? ...

MySQL cross-database WHERE clause

I am working on a project that obtains values from many measurement stations (e.g. 50000) located all over the world. I have 2 databases, one storing information on the measurement stations, the other one storing values obtained from these stations (e.g. several million). A super-simplified version of the database structure could look li...

MvcContrib Select Control does not highlight in red on ModelError

I would like the MvcContrib select control to be highlighted in red, but currently I can only show the error text. I currently populate security questions in the view: <%= this.Select(Html.NameFor(x => x.Question1).ToHtmlString()) .Options(Model.AllSecurityQuestions, x => x.Id, x => x.Question) .Selected(Mode...