Search Results

Search found 23568 results on 943 pages for 'select'.

Page 12/943 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • XPath select an attribute based on value

    - by Apeksha
    Using VB.Net, I have an XmlNode object, xNode. I need to select an attribute of this node if it has a particular value. e.g. xNode.SelectSingleNode(".[@attr1='1']") I would expect this statement to return the attribute "attr1", only if it has a value of "1". However, I get an error - Expression must evaluate to a node-set. When I tried this - xNode.SelectSingleNode("@attr1[@attr1='1']") It always returns Nothing, even if the attribute has a value of 1. I have tried a lot of different things, but no luck yet. Please help. Thanks.

    Read the article

  • SELECT a list of elements and 5 tags for each one

    - by Vittorio Vittori
    Hi, I'm trying to query a set of buldings listed on a table, these buildings are linked with tags. I'm able to do it, but my problem is how limit the number of tags to see: table buildings id building_name style 1 Pompidou bla 2 Alcatraz bla 3 etc. etc. table tags // they can be 50 or more per building id tag_name 1 minimal 2 gothic 3 classical 4 modern 5 etc. table buildings_tags id building_id tag_id I though to do something like this to retrieve the list, but this isn't compplete: SELECT DISTINCT(tag), bulding_name FROM buldings INNER JOIN buildings_tags ON buildings.id = buildings_tags.building_id INNER JOIN tags ON tags.id = buildings_tags.tag_id LIMIT 0, 20 // result building tag Pompidou great Pompidou france Pompidou paris Pompidou industrial Pompidou renzo piano <= How to stop at the 5th result? Pompidou hi-tech Pompidou famous place Pompidou wtf etc.. etc... this query loads the buildings, but this query loads all the tags linked for the building, and not only 5 of them?

    Read the article

  • MYSQL select query where multiple conditions in same column must exist

    - by David
    I'm putting together a dating site and I'm having a mysql query issue. This works: SELECT * FROM `user` , `desired_partner` , `user_personality` WHERE dob BETWEEN '1957-05-18' AND '1988-05-18' AND country_id = '190' AND user.gender_id = '1' AND user.user_id = desired_partner.user_id AND desired_partner.gender_id = '2' AND user.user_id = user_personality.user_id AND user_personality.personality_id = '2' The sql finds any male (gender_id=1) with ATLEAST personality trait 2 (and possibly other personality traits) between certain age range in the USA (country_id=190) looking for a female (gender_id=2). Question 1) How do I make it so it returns those with personality type 2 ONLY and no other personality traits? Find any man in the USA that is between 22 and 53 that is of personality type 2 (only) that is looking for a woman. Question 2) Supposing I want to find someone that matches personality type 1, personality type 2, and personality type 5 ONLY. There are 14 personality traits in the database and a user can be associated with any of them. Find any man in the USA that is between 22 and 53 that is of personality type 1, 2, and 5 (ONLY) that is looking for a woman.

    Read the article

  • How can I select this element?

    - by Kyle Sevenoaks
    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 to work, and I just can't think more.. Thanks :)

    Read the article

  • Socket Select with empty fd set

    - by whoi
    Hi; Suppose you have an fd set which can have zero or more sockets in it. When I try to call select operation on empty fd set, what I get is -1 as the number of fds which are set, meaning error. So what would you suggest to overcome this problem, you might say do not call if empty but I have a loop and any time fd set can hold 0 or more sockets. What is the best approach about this problem? (we are on C programming language)

    Read the article

  • GWT: Select a TreeItem with right click

    - by Ivan
    I'm capturing a right click event to show a context menu. What I haven't been able to figure out, is how to make the right click actually select the TreeItem, prior to showing of context menu. All help is appreciated. private Tree tree = new Tree() { @Override public void onBrowserEvent(Event event) { if (event.getTypeInt() == Event.ONCONTEXTMENU) { DOM.eventPreventDefault(event); showContextMenu(event); } super.onBrowserEvent(event); } @Override protected void setElement(Element elem) { super.setElement(elem); sinkEvents(Event.ONCONTEXTMENU); } };

    Read the article

  • SQL SELECT with time range

    - by nLL
    Hi, I have below click_log table logging hits for some urls site ip ua direction hit_time ----------------------------------------------------- 1 127.0.0.1 1 20010/01/01 00:00:00 2 127.0.0.1 1 20010/01/01 00:01:00 3 127.0.0.1 0 20010/01/01 00:10:00 .... ......... I want to select incoming hits (direction:1) and group by sites that are: from same ip and browser logged within 10 minutes of each other occured more than 4 times in 10 minutes. I'm not sure if above was clear enough. English is not my first language. Let me try to explain with an example. If site 1 gets 5 hits from same ip and browser with in 10 minutes after getting first unique hit from that ip and browser i want it to be included in the selection. Basically I am trying to find abusers.

    Read the article

  • Select *, max(date) works in phpMyAdmin but not in my code

    - by kdobrev
    OK, my statement executes well in phpMyAdmin, but not how I expect it in my php page. This is my statement: SELECT egid , group_name , limit , MAX( date ) FROM employee_groups GROUP BY egid ORDER BY egid DESC ; This is may table: CREATE TABLE employee_groups ( egid int(10) unsigned NOT NULL, date date NOT NULL, group_name varchar(50) NOT NULL, limit smallint(5) unsigned NOT NULL, PRIMARY KEY (egid,date) ) ENGINE=MyISAM DEFAULT CHARSET=cp1251; I want to extract the most recent list of groups, e.g. if a group has been changed I want to have only the last change. And I need it as a list (all groups).

    Read the article

  • mysql select query optimization

    - by Saharsh Shah
    I have two table testa & testb. CREATE TABLE `testa` ( `id` INT(10) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) DEFAULT NULL, PRIMARY KEY (`id`) ); CREATE TABLE `testb` ( `id` INT(10) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) DEFAULT NULL, `aid1` INT(10) DEFAULT NULL, `aid2` INT(10) DEFAULT NULL, `aid3` INT(10) DEFAULT NULL, PRIMARY KEY (`id`) ); Currently I am running below query for retrieving all rows where id in testa table matches with any columns of aid1,aid2,aid3 in tableb. The query is retreiving acurate result but it is taking minimum 30 seconds to execute which is too much. I have also tried to optimise my query using UNION but failed to do so. SELECT a.id, a.name, b.name, b.id FROM testb b INNER JOIN testa a ON b.aid1 = a.id OR b.aid2 = a.id OR b.aid3 = a.id ; How do i optimize my query so it's total execution time is within 2-3 seconds? Thanks in advance...

    Read the article

  • Hibernate, select by id or unique column

    - by Nican
    I am using hibernate for Java, and I want to be able to select users by id or by name from the database. Nice thing about Hibernate is that it caches the result by id, but I seem to be unable to make it cache by name. static Session openSession = Factory.openSession(); public static User GetUser(int Id) { return (User) openSession.get(User.class, new Integer(Id)); } public static User GetUser( String Name ){ return (User) openSession.createCriteria( User.class ). add( Restrictions.eq("username", Name) ). uniqueResult(); } If I use GetUser(1) many times, hibernate will only show that it executed the first time. But every time I use GetUser("user1"), hibernate shows that it is executing a new query to database. What would be the best way to have the string identifier be cached also?

    Read the article

  • Send select's values in array

    - by Ockonal
    Hello, I have such select list in html: <input type="checkbox" name="drive_style" value=1 checked />123<br /> <input type="checkbox" name="drive_style" value=2 />123<br /> <input type="checkbox" name="drive_style" value=3 checked /> 123<br /> <input type="checkbox" name="drive_style" value=4 />123<br /> <input type="checkbox" name="drive_style" value=5 checked />123<br /> I have to send values(1, 3, ...) of checked boxes to the php script (I'm using ajax with jquery) like an array. Something like: drive_style[index]. $.post('post_reply.php', {'drive_style' : $('drive_style')}, function(data){ alert(data); }); In PHP script: print_r($_POST['drive_style']); [object Object]

    Read the article

  • select row from table and substitute a field with one from another column if not null

    - by EarthMind
    I'm trying construct a PostgreSQL query that does the following but so far my efforts have been in vain. Problem: There are two tables: A and B. I'd like to select all columns from table A (having columns: id, name, description) and substitute the "A.name" column with the value of the column "B.title" from table B (having columns: id, table_A_id title, langcode) where B.table_A_id is 5 and B.langcode is "nl" (if there are any rows). I've tried using a CASE and COALESCE() but failed due to my inexperience with both concepts. Thanks in advance.

    Read the article

  • how to select and group mysql data based on the follwoing table

    - by user1151680
    how can I achieve the desired result in mysql if my table looks like this. result|year 1 |2011 2 |2011 1 |2011 0 |2011 1 |2012 2 |2012 1 = Won, 2 = lost, 0 = draw Every year can have multiple values like this. Not sure how I can get the desired result like below. year won lost draw totalPlayed 2011 2 1 1 3 2012 1 1 0 2 I have tried the following query but does not get the desired result select year, league_types.league_name, sum(if(result = 1,1,0)) as won, sum(if(result = 0,1,0)) as draw, sum(if(result = 4,1,0)) as noResult, sum(if(result = 2,1,0)) as lost, sum(if(result = 3,1,0)) as tied, sum(if(result > 0 and result < 4,1,0)) as played from match_score_card inner join fixtures on match_score_card.match_id = fixtures.match_id inner join league_types on fixtures.league_id = league_types.league_id where team_id = 1 group by year order by year desc

    Read the article

  • How can i get the selected option name or id of a select element using jQuery

    - by bill
    Hi All, i have a "questionairre" that is made up of a series of select boxes. i need to use two properties in the options. For each selected option i need the value (which i know how to get and is working fine) but i also need to store an additional value which represents the id of the specific option in a DB. One solution would be to put the two values in the "value" property and parse it out.. but if there is some other property i can use that might be easier and clearer.. can i add a custom property?? like databaseId that could be accessed with jQuery? thanks for ANY suggestions.

    Read the article

  • Select where a value present

    - by Roy
    First a database example: id, product_id, cat, name, value -------------------------------- 1,1,Algemeen,Processor,2 Ghz 2,1,Algemeen,Geheugen,4 GB 3,2,Algemeen,Processor,3 Ghz 4,2,Algemeen,Geheugen,4 GB 5,3,Beeldscherm,Inch,22" 6,3,Beeldscherm,Kleur,Zwart 7,3,Algemeen,Geheugen,3 GB 8,3,Algemeen,Processor,3 Ghz I want with one query to select the follow id's: 1,2,3,4,7,8 Because the cat = algemeen and the name = processor by these products. ID 5,6 are only present by product 3. So, the entry's (cat and name) which are present by all products (product_id) have to be selected. The database contains 80.000 entry's with a lot of diffrent cat's, name's and value's. Is this possible with one query or is some php necessary? How do I do this? My apologies for the bad English.

    Read the article

  • MySQL SELECT where if stores have X, show me everything that they have

    - by tnt0932
    I have a MYSQL table like this: STORES (SPID, StoreID, ProductID); And data like this: { 1 | s1 | p2 } { 2 | s1 | p7 } { 3 | s1 | p8 } { 4 | s2 | p1 } { 5 | s2 | p3 } { 6 | s2 | p6 } { 7 | s2 | p9 } { 8 | s3 | p2 } { 9 | s3 | p5 } And I would like to: Use a MYSQL SELECT query to get results, where if a store has a certain product, then a list of all of the products at that store will be returned. For example, if I were looking for "p2", then I would like to know that "s1" has "p2, p7, p8" and "s3" has "p2, p5". Please let me know if you require any more information. I'm not sure what is required to solve this issue (Which is probably why I can't search and find the answer!) Thank you.

    Read the article

  • How to select first entry of the day grouped by user in SQL

    - by mikepreble
    I've looked around and can't quite grasp the whole answer to this SQL query question needed to extract data from an MS Access 2000 table. Here's an example of what the table [Time Sub] looks like: CLIENT_ID, DATE_ENTERED, CODE, MINUTES 11111, 5/12/2008 3:50:52 PM, M, 38 11111, 5/12/2008 2:55:50 PM, M, 2 11714, 5/13/2008 1:15:32 PM, M, 28 11111, 5/13/2008 6:15:12 PM, W, 11 11112, 5/12/2008 2:50:52 PM, M, 89 11112, 5/12/2008 5:10:52 PM, M, 9 91112, 5/14/2008 1:10:52 PM, L, 96 11112, 5/12/2008 5:11:52 PM, M, 12 I need to select the first entry of each day per client that's NOT code L or W. I know this can be done in a SQL statement, but I just can't figure out how. I can get close, but never come up with the right output. Any help is appreciated. Thanks, Mike

    Read the article

  • Select multiple unique lines in MySQL

    - by MartinW
    Hi, I've got a table with the following columns: ID, sysid, x, y, z, timereceived ID is a unique number for each row. sysid is an ID number for a specific device (about 100 different of these) x, y and z is data received from the device. (totally random numbers) timereceived is a timestamp for when the data was received. I need a SQL query to show me the last inserted row for device a, device b, device c and so on. I've been playing around with a lot of different Select statements, but never got anything that works. I manage to get unique rows by using group by, but the rest of the information is random (or at least it feels very random). Anyone able to help me? There could be hundreds of thousands records in this table.

    Read the article

  • SQL SERVER – UNION ALL and ORDER BY – How to Order Table Separately While Using UNION ALL

    - by pinaldave
    I often see developers trying following syntax while using ORDER BY. SELECT Columns FROM TABLE1 ORDER BY Columns UNION ALL SELECT Columns FROM TABLE2 ORDER BY Columns However the above query will return following error. Msg 156, Level 15, State 1, Line 5 Incorrect syntax near the keyword ‘ORDER’. It is not possible to use two different ORDER BY in the UNION statement. UNION returns single resultsetand as per the Logical Query Processing Phases. However, if your requirement is such that you want your top and bottom query of the UNION resultset independently sorted but in the same resultset you can add an additional static column and order by that column. Let us re-create the same scenario. First create two tables and populated with sample data. USE tempdb GO -- Create table CREATE TABLE t1 (ID INT, Col1 VARCHAR(100)); CREATE TABLE t2 (ID INT, Col1 VARCHAR(100)); GO -- Sample Data Build INSERT INTO t1 (ID, Col1) SELECT 1, 'Col1-t1' UNION ALL SELECT 2, 'Col2-t1' UNION ALL SELECT 3, 'Col3-t1'; INSERT INTO t2 (ID, Col1) SELECT 3, 'Col1-t2' UNION ALL SELECT 2, 'Col2-t2' UNION ALL SELECT 1, 'Col3-t2'; GO If we SELECT the data from both the table using UNION ALL . -- SELECT without ORDER BY SELECT ID, Col1 FROM t1 UNION ALL SELECT ID, Col1 FROM t2 GO We will get the data in following order. However, our requirement is to get data in following order. If we need data ordered by Column1 we can ORDER the resultset ordered by Column1. -- SELECT with ORDER BY SELECT ID, Col1 FROM t1 UNION ALL SELECT ID, Col1 FROM t2 ORDER BY ID GO Now to get the data in independently sorted in UNION ALL let us add additional column OrderKey and use ORDER BY  on that column. I think the description does not do proper justice let us see the example here. -- SELECT with ORDER BY - with ORDER KEY SELECT ID, Col1, 'id1' OrderKey FROM t1 UNION ALL SELECT ID, Col1, 'id2' OrderKey FROM t2 ORDER BY OrderKey, ID GO The above query will give the desired result. Now do not forget to clean up the database by running the following script. -- Clean up DROP TABLE t1; DROP TABLE t2; GO Here is the complete script used in this example. USE tempdb GO -- Create table CREATE TABLE t1 (ID INT, Col1 VARCHAR(100)); CREATE TABLE t2 (ID INT, Col1 VARCHAR(100)); GO -- Sample Data Build INSERT INTO t1 (ID, Col1) SELECT 1, 'Col1-t1' UNION ALL SELECT 2, 'Col2-t1' UNION ALL SELECT 3, 'Col3-t1'; INSERT INTO t2 (ID, Col1) SELECT 3, 'Col1-t2' UNION ALL SELECT 2, 'Col2-t2' UNION ALL SELECT 1, 'Col3-t2'; GO -- SELECT without ORDER BY SELECT ID, Col1 FROM t1 UNION ALL SELECT ID, Col1 FROM t2 GO -- SELECT with ORDER BY SELECT ID, Col1 FROM t1 UNION ALL SELECT ID, Col1 FROM t2 ORDER BY ID GO -- SELECT with ORDER BY - with ORDER KEY SELECT ID, Col1, 'id1' OrderKey FROM t1 UNION ALL SELECT ID, Col1, 'id2' OrderKey FROM t2 ORDER BY OrderKey, ID GO -- Clean up DROP TABLE t1; DROP TABLE t2; GO I am sure there are many more ways to achieve this, what method would you use if you have to face the similar situation? Reference: Pinal Dave (http://blog.sqlauthority.com)   Filed under: Best Practices, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • javascript select box hanging on second select in ie7

    - by bsandrabr
    I have a drop down select box inside a div. When the user clicks on change, a dropdown box appears next to the change/submit button and the user makes a selection which then updates the db and the selection appears instead of the dropdown. All works fine in IE8 and firefox but in IE7 it allows one selection (there are several identical dropdowns) but the second time a selection is made it hangs on please wait. This is the relevant code <td width=200> <input type="button" onclick="startChanging(this)" value="Change" /></td> <script type="text/javascript"> var selectBox, isEditing = false; var recordvalue; if( window.XMLHttpRequest ) { recordvalue = new XMLHttpRequest(); } else if( window.ActiveXObject ) { try { recordvalue = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} } window.onload = function () { selectBox = document.getElementById('changer'); selectBox.id = ''; selectBox.parentNode.removeChild(selectBox); }; function startChanging(whatButton) { if( isEditing && isEditing != whatButton ) { return; } //no editing of other entries if( isEditing == whatButton ) { changeSelect(whatButton); return; } //this time, act as "submit" isEditing = whatButton; whatButton.value = 'Submit'; var theRow = whatButton.parentNode.parentNode; var stateCell = theRow.cells[3]; //the cell that says "present" stateCell.className = 'editing'; //so you can use CSS to remove the background colour stateCell.replaceChild(selectBox,stateCell.firstChild); //PRESENT is replaced with the select input selectBox.selectedIndex = 0; } function changeSelect(whatButton) { isEditing = true; //don't allow it to be clicked until submission is complete whatButton.value = 'Change'; var stateCell = selectBox.parentNode; var theRow = stateCell.parentNode; var editid = theRow.cells[0].firstChild.firstChild.nodeValue; //text inside the first cell var value = selectBox.firstChild.options[selectBox.firstChild.selectedIndex].value; //the option they chose selectBox.parentNode.replaceChild(document.createTextNode('Please wait...'),selectBox); if( !recordvalue ) { //allow fallback to basic HTTP location.href = 'getupdate.php?id='+editid+'&newvalue='+value; } else { recordvalue.onreadystatechange = function () { if( recordvalue.readyState != 4 ) { return; } if( recordvalue.status >= 300 ) { alert('An error occurred when trying to update'); } isEditing = false; newState = recordvalue.responseText.split("|"); stateCell.className = newState[0]; stateCell.firstChild.nodeValue = newState[1] || 'Server response was not correct'; }; recordvalue.open('GET', "getupdate.php?id="+editid+"&newvalue="+value, true); recordvalue.send(null); } } </script> If anyone has any idea why this is happening I'd be very grateful

    Read the article

  • Automatically select option from select menu with link

    - by Ben
    Hello there, I am trying to use php (and if not php, javascript) to link to a page and include a "?type=foo" or "#foo" at the end of the link so that when the linked page loads it will automatically select a specific option, depending on the end of the link, from a dropdown menu in a form. I have tried to search for this but do not know what this action is actually called, but I've seen it done before. Does anyone know how to achieve this? Thanks very much.

    Read the article

  • jqGrid dynamic select option - beforeEditCell not firing

    - by mango
    I'm creating a jqgrid with one drop down column. I need the options of the drop down columns to change dynamically so I thought I can catch the beforeCellEdit event. however it does not seem to be firing. any idea on what i am doing wrong? there is no error, and i did check that i have included the jqgrid edit js files. var lastsel2; jQuery(document).ready(function(){ jQuery("#projectList").jqGrid({ datatype: 'json', url:'projectDrv.jsp', mtype: 'GET', height: 250, colNames:['Node','Proposal #', 'Status', 'Vendor', 'Actions'], colModel :[ {name:'node', index:'node', width:100, editable:false, sortable:false}, {name:'proposal', index:'proposal', width:100, editable:false, resizable:true }, {name:'status', index:'status', width:100, resizable:true, sortable:false, editable:false }, {name:'vendor', index:'vendor', width:100, resizable:true, editable:false, sortable: false }, {name:'actions', index:'actions', width:100, resizable:true, sortable:false, editable: true, edittype:"select" } ], pager: '#pager', rowNum: 10, sortname: 'proposal', sortorder: 'desc', viewrecords: true, onSelectRow: function(id){ if (id && id!==lastsel2){ jQuery('#projectList').jqGrid('restoreRow',lastsel2); jQuery('#projectList').jqGrid('editRow',id,true); lastsel2 = id; } }, beforeEditCell: function(rowid, cellname, value, irow, icol) { alert("before edit here " + rowid); // set editoptions here } });

    Read the article

  • fluent nhibernate select n+1 problem

    - by Andrew Bullock
    I have a fairly deep object graph (5-6 nodes), and as I traverse portions of it NHProf is telling me I've got a "Select N+1" problem (which I do). The two solutions I'm aware of are Eager load children Break apart my object graph (and eager load) I don't really want to do either of these (although I may break the graph apart later as I forsee it growing) For now.... Is it possible to tell NHibernate (with fluentnhib) that whenever i try to access children, to load them all in one go, instead of selectn+1ing as i iterate over them? I'm also getting "unbounded results set"s, which is presumably the same problem (or rather, will be solved by the above solution if possible). Each child collection (throughout the graph) will only ever have about 20 members, but 20^5 is a lot, so i dont want to eager load everything when i get the root, but simply get all of a child collection whenever i go near it Edit: an afterthought.... what if i want to introduce paging when i want to render children? do i HAVE to break my object graph here, or is there some sneakyness i can employ to solve all these issues?

    Read the article

  • php json jquery and select box

    - by user253530
    I have this php code $jsonArray = array(); $sql = "SELECT ID,CLIENT FROM PLD_SERVERS"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $jsonArray[] = array('id'=>$row['ID'],'client'=>$row['CLIENT']); } echo json_encode($jsonArray); And this js function autosearchLoadServers() { $.post("php/autosearch-load-servers.php",function(data){ var toAppend = ""; for(var i = 0; i < data.length; i++){ toAppend += '<option value = \"' + data[i].id + '\">' + data[i].client + '</option>'; } $("#serverSelect").empty(); $("#serverSelect").html(toAppend); }); } The problem is that i get only undefined values. How can this be? The values are in the JSON, i checked using firebug in mozilla so there has to be something with the data variable but i can't understand what. I tried different ways and no results.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >