select

How to select non-consecutive rows in MySQL?

If the primary keys of the records are 1,3,4,5,6,8 I want to select the records with pk:1,6 NOTE I don't know which ids are non-consecutive ...

ruby on rails-Problem with the selection form helper

Hello I have a form in witch users can add their working hours view them and edit them (All in one page). When adding working hours the user must select a project from a dropdown list. In case the action is adding a new hour record the dropdown field should remain empty (not selected) in case the action is edit the dropdown field should ...

HTML muliple select should look like HTML select

Hi I am trying to use a HTML select box with 'multiple' select options and size to 1 as below ` <SELECT NAME="toppings" MULTIPLE SIZE=5> <OPTION VALUE="mushrooms">mushrooms <OPTION VALUE="greenpeppers">green peppers </SELECT> When the size is set to 1 small scrollbar appears which makes the page clumsy.If I increase the size its eatin...

IE font size decrease does not cause select box height to decrease

I have a font resize function on my page which increases the font size via javascript for the entire page. This works fine in most browsers except IE. When decreasing the font size after increasing it, the select boxes new height does not decrease, even though the font size is decreasing on it. Instead the smaller font appears to be p...

Rails - Active Record :conditions overrides :select

I have a fairly large model and I want to retrieve only a select set of fields for each record in order to keep the JSON string I am building small. Using :select with find works great but my key goal is to use conditional logic with an associated model. Is the only way to do this really with a lamda in a named scope? I'm dreading that ...

Native SQL - How to set the schema and database names

Im using Native SQL from ABAP language. The query to get data is something like this SELECT COUNT(ROWID) FROM <SCHEMANAME>.<TABLENAME>;@<DATABASENAME> INTO :localvariable I want to somehow set the schemaname and database name as default so that i do not need to use them in the SELECTs later. Then i can only use the table name in the...

Javascript select boxes based on previous selection

Hello All, How can I ensure that this does NOT open in a new window?? onclick="ob=this.form.table;window.open(ob.options[ob.selectedIndex].value)"/> ...

ignore some values in insert into select from sql stament

Suppose that I have a Table Symbols(Symbol, Value) and a Table SymbolValues (Symbol, Value) which contains a list of values for the symbol. How to choose maximum values fromt he SymbolValues table and insert into Symbols table. For Example, The SymbolValues Table has following values A 1 A 2 A 3 B 6 B 7 Then only A 3 and B 7 should b...

problem with select boxes - second options based on first selection

Hello All, I just posted a question about opening in a new window but if I use window.location it doesn't work?? is there a problem with my javascript? <script type="text/javascript"> function setOptions(chosen){ var selbox = document.formName.table; selbox.options.length = 0; if (chosen == " ") { selbox.options[selbox.options....

Make SQL Select same row multiple times

I need to test my mail server. How can I make a Select statement that selects say ID=5469 a thousand times. ...

How do I bring forward the SELECTED option in PHP from MySQL?

Hi all, In my update form, I want the fields to recall the values that are already stored. This is very simple in a text field, but for my drop down () I'm having trouble with PHP reading the already stored name of user. Here is my query and code: $sql = "SELECT users.user_id, users.name FROM users"; $result = mysql_que...

How to find 3rd max value of a column using MAX function in sql server?

Yesterday i had a question in an interview which i thought i could find answers here in SO... How to find 3rd max value of a column using MAX function in sql server? Consider the column to be Wages 20000 15000 10000 45000 50000 ...

create jquery array to use as options

Hi all, I'm sure this is really simple, but I can't seem to get it working. I have a "time" select list, which has a number as "rel" attached to each option. If the user changes the time select, I want a new list of options to display depending on what is selected. If that makes sense? Here's my first select: <select name="time" id="ti...

Get content of a single cell from a DataGrid in Flex 3

I want to select information in a single cell from my DataGrid in Flex 3. Specifically, I'm displaying three phone numbers per line and the user needs to be able to select one of those numbers, from any row, but not the whole row. While similar to this, I am displaying the DataGrid to the user. The answer for that question was to manip...

MySQL: select words as rows even som are "new line" separated in one field

Hi I have a table with a field where words are written separated with new lines. So a select on this single field from to rows will output 3 lines for first row and 2 lines for second row: Row1 designationer nye kolonier mindre byer Row2 udsteder bopladser I would like to do a select that select all thes...

Selecting all object for which not exists value

I have two tables: object that has object_id column and avalues that have object_id (FK for object.object_id) and value_type (for simplicity I ommited other columns). I want to select all objects that don't have values with specified type. My select looks like this: SELECT object_id FROM object WHERE NOT EXISTS (SELECT true FROM avalue...

How to order by results from 2 separate tables in PHP and MySQL.

I am trying to output results of 2 sql queries to one JSON file. The problem is that I would like to order them ascending by distance which is the result of equation that takes homelat and homelon from the users table and lat, lng from locations table.(basically it takes lattitude and longitude of one point and another and computes the d...

Query MSQL for winners, starting at xth place using SELECT

In my MySQL table Winners, I have a list of people who have won. What I'd like to do is select a list of the names of 10 winners. So what I have right now is this: SELECT name FROM Winners ORDER BY points DESC LIMIT 10 This returns the first 10 winners which is great. But how can I make it (for example) return 10 winners, but starti...

Dropdown not working in some IE 6 browsers

We unfortunately find ourselves having to support our product in IE 6 because some of our largest users use it. One of them called today and told me that one of the dropdowns doesn't work when he clicks on it - it simply selects the first item. I checked the markup and the entire contents of the select control are being sent: <select o...

How would I order this SELECT statement in MySQL?

cursor.execute("SELECT user_id FROM myapp_location WHERE\ GLength(LineStringFromWKB(LineString(asbinary(utm), asbinary(PointFromWKB(point(%s, %s)))))) < %s"\ ,(user_utm_easting, user_utm_northing, 500)); This query selects users which are within 500 feet of the current user. How would I order people by the distance? (the...