select

Grabbing the right record in a drop down from mysql

I'm using a form where the user can edit an entry. Everything is populating and all is well with the exception that I can't get the drop down to show the project that they've already assigned the image to. $project_qry = "SELECT * from projects ORDER BY title ASC"; $project_res = mysql_query($project_qry); $project_drop = "<select nam...

Verify two columns of two different tables match exactly.

When writing views and nesting views within deeper views I sometimes miss something and end up losing rows/data. How can I check that columns from two different tables have an exact match of data? Example: select count(distinct table1.col1) from table1 where table1.col1 not in (select distinct table2.col1 ...

SQL Select table1.columa as table1.columb

I am working on a database join and I want to do the following: Select tabel_one.id, tabel_one.title, tabel_one.content, table_two.value as table_two.key from tabel_one Join table_two ON table_two.id = table_one.id .... The Important part is: table_two.value as table_two.key Is there a way this could w...

how do I disable options based on the previous selection?

I have three drop-down menus for each sample shirt; product, colour and grade. Not all products are available in all colours and/or grades. I would like to disable the options that are not available based on the users selection. I've tried using this answer here (using a radio select). Unfortunately, I can't get it to work with an opt...

JQuery + Rails + Select Menu

I want to have a select menu to change a field on a Customer dynamically, I've never used Jquery with a select menu, and I'm having problems. The code: <% form_for @customer , :url => { :action => "update" }, :html =>{:class => "ajax_form"} do |f| %> Pricing: <%= select :customer, :pricing, Customer::PRICING, {}, :onchange => "$('this...

sql-server: how to select from dupilcate rows from table?

Hi All, I have the following table. CREATE TABLE TEST(ID TINYINT NULL, COL1 CHAR(1)) INSERT INTO TEST(ID,COL1) VALUES (1,'A') INSERT INTO TEST(ID,COL1) VALUES (2,'B') INSERT INTO TEST(ID,COL1) VALUES (1,'A') INSERT INTO TEST(ID,COL1) VALUES (1,'B') INSERT INTO TEST(ID,COL1) VALUES (1,'B') INSERT INTO TEST(ID,COL1) VALUES (2,'B') I ...

SQL Server: how can I list distinct value of table in a single row, separated by comma

I have the following table: CREATE TABLE TEMP (ID INT, SEGMENT CHAR(1), SEGOFF INT, CHECKED SMALLDATETIME) INSERT INTO TEMP VALUES (1,'A',0,'2009-05-01') INSERT INTO TEMP VALUES (2,'B',1,'2009-05-01') INSERT INTO TEMP VALUES (3,'C',0,'2009-05-01') INSERT INTO TEMP VALUES (4,'A',0,'2009-05-02') INSERT INTO TEMP VALUES (5,'B',2,'2009-05-...

Need help with a SELECT statement

I express the relationship between records and searchtags that can be attached to records like so: TABLE RECORDS id name TABLE SEARCHTAGS id recordid name I want to be able to SELECT records based on the searchtags that they have. For example, I want to be able to SELECT all records that have searchtags: (1 OR 2 OR 5) AND (6 OR 7)...

Populating a Dropdown list in PHP dynamically

Hi, I have a small PHP page which contains two drop down lists I need to populate the second one according to the result selected in the first drop down list .... is this possible? In other words I need to use the value selected from the first drop down list and use it in the dB query used to populate the second drop down list (but th...

triying to do a combo select with this.val() but it doesnt show the second select

Im triying to do a combo where the when the user selects Chile out of the select box, a second select shows up showing the cities. The jQuery code Im using is this. $(document).ready(function() { var ciudad = $("#ciudad"); ciudad.css("display","none"); $("select#selectionpais").change(function() { var hearValue = $(...

How to select view in Oracle from another connection(other user)?

Hi, I want to select a view from my sys user, but with other connection. I need to select view DBA_USERS. Is there any way of doing so? I am new in Oracle, so maybe it is silly question, but still, I have no idea how to do it. ...

Threads and select mixing in ruby

Hello, The Ruby framework I am using provides a TcpServer class which, surprisingly, establishes a TcpServer. It has two threads - one monitors with Kernel.select the listener thread and dispatches a on_client_connect(fd) method and the other monitors established connections and dspatches on_client_data(fd). I want to use the TcpServer...

Zend Framework query taking too long to execute

I have a query to check how many unique votes each photo has in a photo contest. In my Votes.php model I have this query, which for 200 photos is taking around 15 minutes to complete: public function getVotes() { $itemsTable = new Photocontest_Model_Photos(); $items=$itemsTable->fetchAll(); ...

Iterating result of Select Query

Hi experts, I have a question related to select query. here i am explaining down below. i have a table with the following data **Column1(Primary Key) Column2 Column3** ------ --------- -------------- 1 C 2 C 3 Nul...

php multiple select drop down

here is my mysql and php code layout: I have 3 tables tableA stores unique "person" information tableB stores unique "places" information tableC stores not unique information about a person and places they have "beenTo". here is how i layed out my form: -one big form to insert into "person" tableA; "beenTo" tableC in the form, a per...

Select Box not filling properly in rails

I am creating a select box for a form using this in _form.html.erb <%= f.select(:category_id,options_for_select(@cats)) %> @cats is an array created in my controller like this: @cats = [] categories.each do |c| @cats.push([c.full_name,c.id]) end The select box is properly filled, and the selected foreign key is even properly save...

How can I select this element?

Hi, I have code blindness, it's like snowblindness, just wth far too much code. I have a div class dynamically generated, <div class="even last"> How can I select that with CSS? div.even last { background-color:#ffffff; height:100%; border-top:1px solid #F5F5F5; padding:2px; margin-top:35px; } Doesn't seem t...

Prototype set selected option based on other select

Hi, how can I "copy" the selected option between two s that have the same options using prototype ? I tried getting the selected option from the "master" combo using function getSelectedArea() { $$('#areacont1 option').find(function(ele){return !!ele.selected}) } which returns null And setting the second combo using var c2ROptions...

How to use the iterator tag in Struts2?

I have class A { private String field1; private String field2; private B b; } class B { private String field3; } List<A> myList; How can I access the field3 using the myList? This would work for field1 and field2, but how about field3? <s:iterator value="myList"> <tr> <td><s:proper...

How do I return count and not count in a SQL query?

Hi, If I have a table AgentID | IsNew | TeamID 1 N 1 2 Y 2 3 Y 2 4 N 2 5 Y 1 I want to return the following from a query: Team | CountIsNew = N | CountIsNew = Y 1 1 1 2 1 2 Is there a way I can do this? Using Oracle 10 ...