select

Trying to create dynamic select boxes with Javascript and jQuery

I'm not a front-end developer and I'm trying to create a select box and add its options totally dynamically using Jacascript and jQuery. I'm almost there but am having a problem adding each new select to the div block (the number of selects is different at different times. So far, I can either get the last select created in the followi...

SELECT DISTINCT and count

Hello, the table looks like this: tag | entryID ----+--------- foo | 1 foo | 2 bar | 3 And now i want to get all tags with its usage: foo | 2 bar | 1 How can I do this? Thank you ...

setting html parameter option dropdown value via url

Hi, I would like to set the default of a drop-down menu of a webpage by passing the default value in the url. Id like to put a link on a another webpage to this site where the: "I would like my contribution to go to:" option is set to Pakistan: moonsoon floods e.g. by doing something like: http://donate.ifrc.org/?desc=Pakistan: mon...

GROUP BY shows all distinct columns

mysql> select * from products; +---------+-------------+-----------+------+ | prod_id | prod_source | prod_type | flag | +---------+-------------+-----------+------+ | 1 | USA | 2 | 0 | | 2 | USA | 2 | 0 | | 3 | USA | 2 | 0 | | 4 | USA | 3 |...

SQL: How to select 1st, 3rd, 11th and nth row from a table?

How to select 1st, 3rd, 11th and nth row from a table? ...

MySQL Select all columns from one table and some from another table

How do you select all the columns from one table and just some columns from another table using JOIN? In MySQL. Thanks! ...

sql query is returning the same values twice

Hi There, I have this sql query, and it should be returning two values, which is does but it returns each returned row twice, the sql looks like this, SELECT * FROM `mailers` LEFT JOIN `mailer_content` ON `mailers`.`id` = `mailer_content`.`mailer_id` LEFT JOIN `mailer_images` ON `mailer_content`.`id` = `mailer_images`.`content_i...

Make select list output in alphabetical order in Rails?

Hi Everyone, I have a select list in my model which lists a persons name with their employers name: <li>Case Handler Name<span><%= f.select :person_id, Person.all.collect { |x| [x.name_and_company, x.id] } %></span></li> def name_and_company return "#{personname} (#{company})" end Is it possible to force the select list to output ...

SQL select statement dynamical multiple conditon

I have 3 tables, say images(id), news(id), types(id, category, obj_id, type) For example, categories of news A are black, red. data struct is like { types(xxxx1,red,news_A,news) types(xxxx2,black,news_A,news) } now I need find out all images with type red and black. In this case, I need images_B { types(oooo1,red,images_B,i...

Mysql Select to find duplicates

Hi all, can somebody help me to write a sql select to perform a task. So the problem is that we have a table and there are some duplicates, so i need to find where name, street and house are the same and to group somehow them. I have almost this situation but the difference is that i would like to group them to find what is duplicate o...

Dynamically adding select fields using LINQ lambda

Lets say we have an expression: var prices = from p in PriceDB.Prices where p.TypeID == 12 orderby p.PriceType.Title select p; Is it possible to modify the select list? I imagine it looking something like this: var newPriceList = prices.Select( p => p.ExchangeRate ); This may be an odd reques...

HTML select refreshes page when I submit form

Hi all, I have a simple form with some input fields and a dropdown list (). I use 'return false' with jQuery to avoid the page to refresh after I submit the form and this works like it should. However, with the 'select' html in the form it does refresh the page and this is not what I want. Does anybody have an idea on how to avoid the ...

Getting rows from one table and latest 1 row from an associated table, in LINQ...

Ok, I think this question is similar to this one: http://stackoverflow.com/questions/1704821/linq-to-sql-groupby-and-max-to-get-the-object-with-latest-date But I have a table which I want to return a lot of rows from. It's primary key is used as a foreign key in a second table. For each row returned from the first row, I also want to r...

Rails: How to use select in formtastic with activeRecord

I'm new to rails and I guess you can answer this question easily. What I got so far is = f.input :task, :as => :select, :collection => @tasks, :include_blank => true where the tasks collection is defined by Task.find(:all) within in the controller. This does in fact work, shows me a dropdown-list of all Tasks to select from and c...

Potential MySQL Buffer Problem? Need Help Debugging.

Hello, From the middle of a script I've been able to isolate a (very sudden) issue with querying some data from MySQL using PHP. Using the same connection within the same API in the past, I have been able to do numerous (millions of) individual INSERT queries in the past. Also, I've been able to return and manipulate large SELECT resu...

Implementing timer using select

I am planning to write a small timer library in C using timerfd_create. The basic user of this library will have two threads application thread Timer thread There will be a queue between these two threads so that whenever the application wants to start a timer, it will push a message into the queue which the timer thread will then ...

Help creating a SQL SELECT statement

I have data in the following format in a table: Acct# Amount 123 3.4 123T 4.5 124 2.3 124T 4.5 125 1.2 125T 2.4 How do I create a select statement where it totals up the account number as 123+123T and gives the following output: 123 7.9 124 6.8 125 3.6 ...

Passing a javascript variable to Ruby in a combo box nav

Updated Example I am using a Select Box as a nav. When I select an item, I would like to be redirected to that page. = select (@organization, "tabs", @organization.tabs.collect { |t| t.title }, {} { :onchange => "escape_javascript(#{ render edit_organization_tab_path(@organization, this.value)})"} ) So this example does not work beca...

Help creating a single SELECT statement for SQL Reports

I am trying to create an payment report which lists the sum in each account. The table is in SQL SERVER 2005 and it has the following table [Account]    [Amount]   [Type] 1111     10     C 1111     10     C 1111     15     D 1111     5     D 1112     10     C 1112     15     C 1112  ...

MySQL Select Query when wanting groups of x elements returned in batches

How to return a select result with batches through a single query, that should be a straight forward compound select somehow. Below is a sample table and a simple query that will generate the desired result by currently using a temporary numeric column that could not work in the final real world process. There are only two key columns ...