select

I need to have an HTML <select multiple> with a disabled element

I need a way to have a multi-select box that has a disabled element. I want the box to look like: All -----or----- option 1 option 2 with the "----or----" not being able to be selected. So far my code is pretty simple: <select multiple size="4" > <option value="0">All</option> <option value="1">----or----</option> <option ...

drupal Webform select list empty first value

I need for my select lists to have a default option of an empty value, or "Select" with no value. I don't see any mention of how to do this in the documentation. // $Id: webform.module,v 1.196.2.47 2010/08/16 17:54:19 quicksketch Exp $ Thanks ...

How do I add a WHERE statement to this :select in rails?

I have the current find statement with :select: @list = Contact.find :all, :select => "companies.name AS co_name, COUNT(contact_emails.id) AS email_count, COUNT(contact_calls.id) AS call_count, COUNT(contact_letters.id) AS letter_count, COUNT(contact_postalcards.id) AS posta...

How to combine multiple columns as one and format with custom strings?

SELECT id, <X> AS name FROM `table` Basically <X> is a combination of lastname + ', ' + firstname example would be id | name | 2 | Smith, Bob | 3 | Jones, Susy | This is just an example, I don't really want to combine names so simple. ...

Rendering a hierarchy using LINQ?

Hi everyone, Let say we have a class Category { ID, Name, ParentID } and a List 1, 'Item 1', 0 2, 'Item 2', 0 3, 'Item 3', 0 4, 'Item 1.1', 1 5, 'Item 3.1', 3 6, 'Item 1.1.1', 4 7, 'Item 2.1', 2 Can we using LINQ to render a tree like: Item 1 Item 1.1 Item 1.1.1 Item 2 Item 2.1 Item 3 Item 3.1 Any helps is appreci...

Set selected on select change with jQuery

A kinda funny problem, im doing a .clone() on a select-element (for preview purpose) and the selected value isnt transferred. I.e my solution is to set selected="selected" on selectbox change. But, i can't get it to work in any form. Ideas? $("select").change( function() { $(this).find("option:selected").attr("selected", "selected"...

Add in select box ...

Hello, I have a dual list box, named "source" and "target". In some point I reload the content of the source list box like this : $('.sourceSelect').find('option').remove().end().append(msg); the content of msg is <option>...</option> I'd like add in the source list only the option put in the target. Sample, the source as Group1,Gr...

rails: add a attribute to a option tag through collection_select

Hello everybody, I have a collection_select: f.collection_select(:selected_id, @subcategories, :id, :cat_transl) which turns into the following tags: <option value="4">Deutsch</option> <option value="5">Chinesisch</option> <option value="6">Spanisch</option> <option value="10">Mathematik</option> What I want is to add a attribute ...

Using case in a sql select statement

Consider a table with a column amount, Amount -1235.235 1356.45 -133.25 4565.50 5023 -8791.25 I want to my result pane to be like this, Debit Credit 0 -1235.235 1356.45 0 0 -133.25 Here is my stored procedure, USE [HotelBI_CustomDB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[SP_Ge...

Select query with regular expression - MySql

I want to select records if a particular column has numbers in its name. Table 1 ID EmpCode EmpName 1 1C Name1 2 2C Name2 3 C3 Name3 4 CD Name4 5 CD Name4 6 C6D Name6 7 7CD Name7 I need to select records 1,2,3,6,7 based on EmpCode. How can this be pe...

MySQL returning results from one table based on data in another table

Before delving into the issue, first I will explain the situation. I have two tables such as the following: USERS TABLE user_id username firstName lastName GROUPS TABLE user_id group_id I want to retrieve all users who's first name is LIKE '%foo%' and who is a part of a group with group_id = 'givengid' So, the query would like somet...

Mysql select with find_in_set with two stringlist

I got in my table this 2 rows: 1, 'Halo: Reach', 2010, ''fps','sci-fi'', '"The best game of the year".', 'Microsoft', 'Bungie', 'XBOX 360', 9.5, 'http://wuwb.com/wp/wp-content/uploads/2009/06/halo_reach.thumbnail.jpg', '', '' 2, 'FIFA 11', 2010, 'sport,soccer', '"The best soccer game ever"', 'EA', 'EA', 'PC, XBOX 360, PS3', 10, 'http:/...

Display items by location. Mysql Select.

I have two MySQL tables, "locations" and items": locations `id` `name` `address` `latitude` `longitude` Now I use a MySQL SELECT that allows a user to enter in their latitude and longitude and it will sort the locations by distance. That works perfect. Now I have a list of items: items `id` `location` `title` `description` `disp...

Appropriate SQL Server approach for retrieving this grouped data?

Hi everyone, I have a table (AU_EMPLOYEE) with two columns named EmployeeID (int) and LastModifiedDate (DateTime). Along with those columns are others containing additional employee data. This is an audit table and every time an employee's data changes in some way a new row is added. So it's quite likely a given employee will have mu...

Why am I getting a PG error on heroku when it works fine on my local rails environment?

I am getting the following error: ReportsController#return_search (ActiveRecord::StatementInvalid) "PGError: ERROR: syntax error at or near \"FROM\"\nLINE 5: ...OUNT(contact_postalcards.id) AS postalcard_count, FROM \"cont...\n It works fine locally, but when I push to heroku I get the error: What do I need to change so it will work...

Building a select distinct on mysql ( zend_db)

I HAVE THE FOLLOWING TABLE, I WOULD LIKE TO GET to do a select distinct on the the column [code], i don't need to get the "A" three times. [ ID ] [ CODE ] [ LIBELLE ] 1 A LIBELLE1 2 B LIBELLE2 3 C LIBELLE3 4 A LIBELLE4 5 A LIBELLE5 6 D LI...

what mysql query is better?

i got 2 mysql queries, that retrieve the same data?, what one do you think is better to use and why? taking into account standards, and better code etc. sorry if this is a stupid question, but im a curious cat! so here goes: QUERY 1: SELECT * FROM (( SELECT u.username, u.picture, m.id, m.user_note, m.reply_id, m.reply_name, m.dt FR...

How to create a new column in a select query

In MS Access, I want to insert a new column into the returned result of a select query. The new column has the same value for every row. For example, my select returns columns A, B and I want C to be the new column created by the select query: A B C ---------- a1 b1 c a2 b2 c a3 b3 c ...

what is this SQL select construct called?

What is the term for the select construct in the following select statement that is in bold? SELECT a.t1 as a, (SELECT b.n as b FROM b WHERE b.x = a.t1), c.t2 as c FROM a,c WHERE a.x = c.x I was explaining that this can be done in oracle but when asked what it was called, I couldn't think of any term. Is there a term for this? Or is i...

SQL query for insert into with a set of constants

It seems like there should be a query for this, but I can't think of how to do it. I've got a table with a composite primary key consisting of two fields I'd like to populate with data, I can do an insert into from one table to fill up half the keys, but I want to fill up the other half with a set of constants (0, 3, 5, 6, 9) etc... s...