select

Plugin for jQuery Text-editor style selection?

What I'm trying to achieve is to use jQuery to mimic the behavior of the text-selection functionality you see in a typical text-editor, except instead of selecting text, I want to select multiple rows of <div>s. However, so far the only "selection" plugins I've found for jQuery operate based on a rectangular lasso model. In particular, I...

SQL query to pull multiple entries with same user_id

I have a table that contains id, created, user_id. I'm wondering if there is a query that'll return all unique user_ids that have more than one entried created within the last week. I started with: $query = "SELECT distinct user_id FROM task where created >= '" . date("Y-m-d", strtotime("-1 week", strtotime($date))) . " 00:00:00' and c...

SQL SELECT speed int vs varchar

I'm in the process of creating a table and it made me wonder. If I store, say cars that has a make (fx BMW, Audi ect.), will it make any difference on the query speed if I store the make as an int or varchar. So is SELECT * FROM table WHERE make = 5 AND ...; Faster/slower than SELECT * FROM table WHERE make = 'audi' AND ...; or w...

SELECT with conditions for preferential source

I have a query which I've been using for sometime however I have a new scenario which I'm not sure how to handle. The query below extracts avg pricing from a table called availables. The problem I have now is that, the data which is contained in this table can come from one of two sources. So I added a source field to the table. Th...

Need help with mysql query

hi all, I'm new to mysql so please can you help me. I have 2 tables "words" and "text" words has columns: word synonyms text has columns: text word article_id I need to get unique words.word, and biggest unique text.atricle_id fields. The same article_id can have different words. for example words word synonyms ---...

How do I use JQuery to find the selected index on a DOM select object?

Given the following javascript: function foo(selectControl) { ... } and the following html: <select onchange="foo(this)"> ... In JQuery, how do I simulate the following functionality: $('#selectList :selected').text(); when instead, I am passing around the real DOM object. I know I can wrap the DOM object up and invoke operation...

How do I SELECT for the following?

I have a table with two columns of ids. TABLE id1 id2 1 1 1 2 1 3 2 1 2 6 2 2 3 1 3 10 3 3 I would like to SELECT every id1 that is matched to a certain combination of id2s. For example, if I have id2 = [1, 2, 3] I would like to return id1 = [1]; If I have id2 = [1, 6] I woul...

Jquery selected index problem

Hi, i am trying to make simple show-hide example but i cant select hidden elements with eq() or not(). Basic structure is like this : <ul id="info"> <li><a href="#">İletişim Adreslerimiz</a></li> <li><a href="#">Kroki</a></li> </ul> <ul id="info-ic"> <li><p>Adres Bilgilerimiz</p></li> <li><p>Kroki Bilgisi</p></li> </ul> and...

jQuery: show() and hide() in order?

I have an area where a chunk of HTML (shown below) is added dynamically as many times as the user would like. No worries there. The problem is, within that HTML block is a select box and then a div that is hidden by default but should be shown if the "dropdown" option is selected from the select menu. <div> <select name="" class="se...

How do I select every pair of 2 sequential elements in jquery?

Can anyone please help me to work out how to achieve the following? I have a set of divs of unknown size. Each div has a class of .feature. I need to run a jQuery script to find all divs with .feature and then find all children as a series of pairs. Each pair will then be submitted to a further jQuery function. For example: 1. <div.fe...

jQuery - eq() seems to refer to a different element than index() - What gives? :/

Here's my code: UPDATED JS jQuery(document).ready(function() { var cookieName = 'activeMenus'; var openMenus = (jQuery.cookie(cookieName) == null) ? 0 : jQuery.cookie(cookieName).substring(1).split(','); var wookie = ''; jQuery('ul.menu li ul').css('display', 'none'); // Reopen all the menus from the cookie if (...

select from table with result of another sql

Is it possible? tag_table : tag        postid aa          22 bb          26 cc          28 post_table : id          content 26            abc 28            cdf 22            fds and I wanna select from post_table with result of search in tag_table my script : first SELECT postid FROM `tag_table` WHERE `tag` L...

In Doctrine ORM, how can I sum seconds to a timestamp field?

I have a starts_at field that keeps a timestamp with the moment something starts. Also, I have another field seconds_long that represents the amount of seconds that the event lasts. I need to select all unfinished events but I just can't find a way to sum the starts_at and seconds_long fields. I first tried to sum them, expecting Doctri...

Rails select tag not working when value different from display or when value in database is integer?

In my rails form I'm using the select tag. <%= f.select :featured, Timeline::TIMELINE_FEATURED, :prompt => "Select" %> The definition of TIMELINE_FEATURES is Yes and No to be displayed, but stored as INT in database: TIMELINE_FEATURED = [ # Displayed stored in db ["No", "0"], ["Yes", "1"] ] My problem ...

ActiveScaffold: How to create a drop-down select for polymorphic association?

I'm trying to create a drop-down select box for a polymorphic association with ActiveScaffold. I have: class Award belongs_to :sponsorship, :polymorphic => :true end class Organization has_many :awards, :as => :sponsorship end class Individual has_many :awards, :as => :sponsorship end While trying to create a select drop-down...

Loading successive select boxes on startup with javascript

I am trying to populate select boxes from javascript at start up, with each one depending on the previous one. In HTML code I have <body onload="start_up()"> <span id="FirstList">xxxxxxx</span> <span id="SecondList">xxxxxxx</span> Javascript code is function start_up() { load_select('','Type1') load_select(document.getElem...

html select item whith html tags

i have select <select id="parentId" name="parentId"><option value="1">ФАСАДНАЯ ШТУКАТУРКА&lt;BR /&gt;&lt;B&gt;&amp;#0171;STUC-O-FLEX&amp;#0187;&lt;/B&gt;</option> <option value="2">ФОНТАНЫ И САДОВАЯ МЕБЕЛЬ&lt;BR /&gt;&lt;B&gt;&amp;#0171;ALEXANDER ROSE&amp;#0187;&lt;/B&gt;</option> </select> how can i make to show html items not t...

SQL Query improvement - Select with max and groupby

Problem Given the following two tables, I'd like to select all Ids for Posts that have their most recent (i.e. last) comment made in the given time span (e.g. Feb 2010). The result of the query should only return Post ID 1, since the most recent comment for Post ID 2 is outside the range of the time span filter. Question I've c...

How do I Combine these SQL SELECT queries into one SELECT statement

Hi, How do I combine these two select statements into one query: SELECT SUM( incidents ) AS fires, neighborhoods AS fire_neighborhoods FROM ( SELECT * FROM `fires_2009_incident_location` UNION ALL SELECT * FROM `fires_2008_incident_location` UNION ALL SELECT * FROM `fires_2007_incident_location` UNION ALL SELECT * FROM `fires_20...

Access - Select distinct records where only one column is distinct

I have an Access table with two columns (ID and Active) with data like the following: ID | Active ------------ 123 | 0 124 | 0 125 | 0 123 | 1 314 | 1 948 | 1 I want to select the distinct records that have a unique ID (that only exist once, not just the first time they exist), but I also need the Active value. If I do a SELECT DI...