select

MYSQL if a select query returns 0 rows then another select query?

if (select * from table where x=1) returns 0 rows then i need (select * from table where x=2 [or some other query]). is it possible to do this in a single MYSQL query with a conditional statement? edit: all answers with 'UNION' work but only if both queries selects from the same table (or tables with the same number of columns). What if...

Hiding Rows Given A Certain Criteria (slow)

I'm trying to hide tr's within a html table if the inputs inside them match a certain criteria. The criteria is defined by a dropdown's selected value. I'm doing it like so: $(function () { $('body').find('#p_Selection').live('change', function () { var type = $('body').find('#p_Selection').attr('value'); var tableRow = $('....

Oracle: select into variable being used in where clause

Can I change the value of a variable by using a select into with the variable's original value as part of the where clause in the select statement? EI would the following code work as expected: declare v_id number; v_table number; --set elsewhere in code to either 1 or 2 begin select id into v_id from table_1 where name = 'John Smith...

Jquery dialog "cache" variable. How avoid it?

I have a dialog confirmation that must be reused for several controls in a html page. Each change in a select, fire this dialog. This is my code: console.info("before:" + select[0].id); dialog = $('#dialogReject').dialog( { autoOpen:false, height:300, width:400, modal:true, buttons: { "Ok": function...

Linq IEnumerable Select Question - Can I do all of this inside my select?

Hi All, I had a quick question. Can I do all of this logic inside the select statement? var entries = atisDAO.GetPME(xl, null); response.Data.Detectors = new List<DetectorDetails>(entries.Select(pme => new DetectorDetails {ID = pme.PlaceNum.ToString()})); if(response.Data.Detectors.Any()) { response.Data.Detectors.ForEach(d =>{ ...

How to set value for the form element using mootools

I have a form that have input element and the select element with multi select. so how can I set value for the input element and select element in mootools. ...

Turning an HTML select element into a tree with submenus

I want to have a select element have a submenus in a tree fashion. I want it to be something like this: Is there a jQuery plugin that can turn a select element into this kind of thing? ...

Repopulating Select form fields in CodeIgniter

I want to re-populate (i.e refill) values posted from a select form field after validation. I know codeigniter user guide proposed using set_select() function but their example from the guide assume you've hard-coded (in HTML) the array of values for the 'select' form element. In my case I used the Form Helper and my select field values ...

Convert/Format a column in a select statement sql server 2005..

I have a sql query which is select DateOfBirth from people and it shows up in the result pane as DateOfBirth 07/07/2010 5:08:02 07/09/2010 5:08:02 07/13/2010 5:08:02 I want to format, 07/Jul/2010 09/Jul/2010 13/Jul/2010 NOTE: DateOfBirth column has datatype nvarchar(50) not datetime... ...

android image inside single select

I want to display images inside single select when it appears inside dialog. How can I do it? ...

symfony: question about a choice widget

Hi, I have a choice widget in a form: $years = range(14,130); $this->widgetSchema['age'] = new sfWidgetFormSchema(); foreach (array('from', 'to') as $value) { $this->widgetSchema['age'][$value] = new sfWidgetFormChoice(array( 'label' => $value, 'choices' => array_merge(array('' => '-'),array_combine($years,$ye...

mysql IFNULL ELSE

I have a select statement where I want to make select conditional like this IFNULL(field_a,field_a,feild_b) so that it checks field a if a is null then the select would be field b is that possible ? ...

Multiple dynamic selections

I need a way of having multiple selections but only one visible at a time. When the user wants to add another selection he/she clicks a button,checkbox,radio..whatever They need to be able to add an unlimited number of selections. Any Ideas? ...

MYSQL Select/Group By: How do I remove a group from the result based on a value of one of it's members?

Consider the table of events below. The OrderID field is a foreign key to an Orders table. OrderID EventType TimeAdded* Processed 1 ... 3 Hours Ago 0 2 ... 5 Minutes Ago 0 1 ... 2 Hours Ago 0 1 ... 1 Hour Ago ...

How to get the select option value in array

Hi I am new to jquery I have the following field <select name[]="post"> <option value="op1">op1</option> <option value="op2">op2</option> <option value="op3">op3</option> </option> </select> How to get the post[0] & post[1] values in Jquery any Idea . ...

Use JQuery Cookie Plugin to save selectlist item in header?

Hello yet again! I created a ajax/ coldfusion select menu in my header on my website that allows one to select a department. This sets a session variable to the department ID. I want to be able to take my "datas" which contains the value of the select box and make sure that variable is applied to the selectlist everytime the header is di...

How multiple select to create a new row?

I have this code: <select name="team[]" size="8" multiple="multiple">$team</select> It lists for example players in that team, I want when user clicks on player it creates a new row where I can input basic info about player which I will add to database via php. ...

create unique id with javascript

I have a form where a user can add multiple select boxes for multiple cities. The problem is that each newly generated select box needs to have a unique id. Can this be done is JavaScript? UPDATE: here is the part of the form for selecting cities. Also note that i'm using some php to fill in the cities when a specific state is selected....

Rails 2 :joins and :include resultset

When fetching content from a database using activerecord, I would like to fetch a custom resultset with specified columns across two tables. SELECT users.name, users.username, users.age, users.city_id, cities.name as city_name FROM users INNER JOIN cities ON users.city_id = cities.id Which would be in AR as Users.find(:all, :join...

Get options of a select box in Internet explorer

Hello I am trying to get the options from a html select element. The logic I am using is working in firefox, but it isn't working in IE. It gives me the length of the options array or the number of options but it isn't giving me the values of options. How do I troubleshoot this issue?? var SelectId= 'select_1'; //id of the html select e...