FAQ Database Discussion Community


How to change multiple form elements via single select

html,forms,select,if-statement,onchange
I'm completely stumped at how I can change the opening tag to have 'method=post' if the second select option is chosen. I am using an Onchange for the form action, but can't figure out how to change the post method too. My latest attempt is with an IF statement as...

Erroneous query works when used as subquery - how? Why?

sql,sql-server,select,subquery,sql-server-2000
Let's consider two tables: MY_DB.dbo.MY_TABLE1 that does contain column MY_PROBLEMATIC_COLUMN MY_DB.dbo.MY_TABLE2 that does not contain column MY_PROBLEMATIC_COLUMN As expected, query1: SELECT MY_PROBLEMATIC_COLUMN FROM MY_DB.dbo.MY_TABLE2 Results with: Server: Msg 207, Level 16, State 3, Line 1 Invalid column name 'MY_PROBLEMATIC_COLUMN'. However, this query2, which uses query1 as a subquery, works: SELECT...

why do I need to update nfds in select call when I remove fds from master set?

c,sockets,select
Given a select call like this: select(fdMax+1, &readFds, NULL, NULL, &timeoutVal) where readFds are updated whenever new fd is added existing fd is removed Whenever new fd is added, I update the fdMax. However, whenever existing fd is removed, I'm wondering if I really need to update the fdMax also...

Select Where Result Is In String [on hold]

mysql,sql,select
I would like to perform a SQL Select Statement where any text in the query is a result. For example, if the query is 'Driving Directions to Dundee in Scotland' I want this result to be returned id: 5 name: Dundee description: Dundee is a City in Scotland Location: 56.4640°...

Pandas DataFrame: Delete specific date in all leap years

python,select,pandas,leap-year
The following sequence is an extract of the pandas DataFrame that I've got: >>> df_t value 2011-01-31 -5.575000 2011-03-31 7.700000 2011-05-31 15.966667 2011-07-31 10.683333 2011-08-31 10.454167 2011-10-31 9.320833 2011-12-31 -0.358333 2012-01-31 -11.550000 2012-03-31 1.700000 2012-05-31 12.333333 2012-07-31 12.816667 2012-08-31 11.837500 2012-10-31 2.733333 2012-12-31 4.075000 2013-01-31 2.450000 2013-03-31 -4.262500 2013-05-31 11.491667...

Selecting and removing a html select option without selecting by index or ID, using vanilla JavaScript

javascript,function,select,options
I need to remove an option on a select box, and I've figured out a potential solution in the code below, but it doesn't feel particularly 'safe' (if another developer decided to add an option to the backend, the option will re-appear). Is there a better way of achieving this...

SQL Select - Group by along with inner join?

sql-server,select,group-by,inner-join,distinct
I'm using the following query: SELECT TOP 12 INVENTABLE.ITEMNUMBER, INVENTABLE.ITEMNAME1, INVENTABLE.ITEMNAME2, INVENTABLE.W_TILBUD, INVENTABLE.COSTPRICE, INVENTABLE.VENDITEMNUMBER, INVENTABLE.A_PRODUCENT, INVENTABLE.GROUP_, INVENTABLE.A_GROSSISTLAGER, INVENTABLE.SupplementaryUnits FROM INVENTRANS INNER JOIN INVENTABLE ON INVENTABLE.ITEMNUMBER=INVENTRANS.ITEMNUMBER WHERE INVENTRANS.ACCOUNT='xxx' AND INVENTABLE.W_VISFORSIDE = 0 AND INVENTABLE.W_VISWWW = 1 AND INVENTABLE.BLOCKED = 0 ORDER BY INVENTRANS.ROWNUMBER DESC This query selects the 12...

How to split column value in Oracle sql

sql,string,oracle,select,substring
How to split a column value which is not having space or any other delimiter. I searched the forums but I couldn't able to find the solution for my scenario. Here is my scenario ID Column_Value 011 abcdefgh The result should be Column_Value1 Column_Value2 abcd efgh...

iOS: change background color using multiple buttons

ios,select,button,background
I am trying to change background color randomly as an effect overtime any of the buttons on the screen are tapped. I would like to control this effect with an On/Off UIButton. Tapping ChangeColorButton just logs “Off” never “On”. Not sure what to do? thanks everyone!! edited code so far!!...

QUERY IN C# ,where statement

c#,.net,select
How can I write this query on c# : SELECT DEPT_ID FROM PERSONNEL_TEMP.DEPARTMENT WHERE DEPARTMENT_NAME=combobox1.text; ...

Add SQL SELECT COUNT result to an existing column as text

sql,sql-server,select,count
I have two tables: 1. TABLE [dbo].[ItemCategories]( [Id] [int] IDENTITY(1,1) NOT NULL, [CategoryId] [int] NULL, [StockId] [int] NULL, 2. TABLE [dbo].[Categories]( [Id] [int] IDENTITY(1,1) NOT NULL, [ParentCategoryId] [int] NULL, [CategoryName] [nvarchar](100) NULL, [Slug] [nvarchar](150) NULL And this query in SQL Server 2012 SELECT [CategoryName], [Slug], [ParentCategoryId], [Id] FROM [Categories] ORDER...

In a MySQL select statement, can I split a text column and then sum the parts as floats?

mysql,select,casting,split
I have a MySQL column that is defined as text. The column, if not null, always contains a list floats separated by a newline character. I have been tasked with making the total amount of those floats searchable with min and max constraints. In the where clause, I would like...

Mysql return only items that have n number of property matches

php,mysql,select,grouping
I have a database of items and each item has various number of properties. Is it possible for MySql only to return items that have a certain number of matches (not properties) when a search is run? Example: I am searching for any item with a wheel that is red...

How to select the last 12 months in sql?

sql,sql-server,select
I need to select the last 12 months. As you can see on the picture, May occurs two times. But I only want it to occur once. And it needs to be the newest one. Plus, the table should stay in this structure, with the latest month on the bottom....

if select changes - disable next or previous select

jquery,select
I have multiple selects - in pairs. And with each pair, I would like for one of them being disabled if the other is changed. <select name='wf_events[]'> <option value=''>--</option>"; foreach ($ug_array AS $ugrow) echo "<option value='".$ugrow["user_group_id"]."'>".$ugrow["user_group_name"]." [".$ugrow["user_group_short"]."]</option>"; echo " </select> or <select name='wf_events[]'> <option value=''>--</option>"; foreach ($users_array AS $userrow) echo...

How to access invisible Unordered List element with Selenium WebDriver, Java

java,select,selenium,selenium-webdriver,html-lists
This is the HTML code: <ul id="personalBar"> <li id="upload" style="display:none;"></li> <li id="personal"> <span class="translate"></span> <span id="userName">qaadmin</span> <div id="dropDownArrow"></div> <ul> <li id="pendingActivities" class="translate" onclick="eCommon.helper.viewAllPendingActivities()" translatekey="MANAGE_STORE">Manage Store</li> <li class="translate" onclick="eCommon.helper.outSourceViewReports()"...

Codeigniter Select JSON, Insert JSON

json,codeigniter,select,insert,routing
I have very simple users database: user_id, user_name, user_email My model this: class Users extends CI_Model { private $table; private $table_fields; private $table_fields_join; function __construct() { parent::__construct(); $this->table = 'users'; $this->table_fields = array( $this->table.'.user_id', $this->table.'.user_name', $this->table.'.user_email' ); $this->table_fields_join = array(); } function select(){ $this->db->select(implode(', ', array_merge($this->table_fields, $this->table_fields_join)));...

Which performs first WHERE clause or JOIN clause

sql,sql-server,select,join,where
Which clause performs first in a SELECT statement? I have a doubt in select query on this basis. consider the below example SELECT * FROM #temp A INNER JOIN #temp B ON A.id = B.id INNER JOIN #temp C ON B.id = C.id WHERE A.Name = 'Acb' AND B.Name =...

SELECT DISTINCT and CONCAT don't return value correcly

mysql,sql,select,distinct,concat
I have a DataBase with this values: CREATE TABLE test ( Id CHAR (50), Time TIMESTAMP , Value CHAR (50) ); INSERT INTO test VALUES ('JOE', '2015-06-05 15:36:21', "ZONE1"); INSERT INTO test VALUES ('ANNA', '2015-06-05 14:27:35', "ZONE2"); INSERT INTO test VALUES ('JOE','2015-06-05 16:27:36', "ZONE2"); INSERT INTO test VALUES ('ANNA', '2015-06-05...

SQL Case Value Switching

sql,select,case
I am passing a series of double values in from another table ranging from -1 to 1. If the value is positive, I want to make it the difference between it and 1 (ie. 0.2 would then become .8). If value is negative, I want it to be the delta...

Cakephp3 transaction find query

mysql,select,transactions,cakephp-3.0
When making a transaction in cakephp3 and adding a get() query inside all works fine. But why is a find() query not performed inside the transaction? I have the following controller in cakephp3: <?php namespace App\Controller; use Cake\Core\Configure; use Cake\Network\Exception\NotFoundException; use Cake\View\Exception\MissingTemplateException; use Cake\Network\Session; use Cake\Event\Event; use Cake\Network\Http\Client; use Cake\ORM\TableRegistry;...

psql max group by just for some columns

sql,postgresql,select,max,psql
I have a problem in a psql query. I don't know how to select only the maximum value from a subset of two columns. It's very hard to explain the problem without an example, so I write one: I have a table like that: Athlete | Category | Points at1...

Check for two decimal digit number in string

sql,sql-server,sql-server-2008,select
I have two sets of records Set 1: -11 -12 -12 AN '' -134 -125 +135 Set 2: 1.15 1.1 In Set 1 I need to check which values are either blank '' or start with a + sign and are greater than 125. In Set 2 I need to...

How to find top usage of IP pairs in PostgreSQL?

sql,postgresql,select,sum
I have a table with source_ip and destination_ip and usage. now i want to find top usage for ip pairs. My table is like this: source_ip | destination_ip | usage 192.168.1.1 | 192.168.1.2 | 20 192.168.1.2 | 192.168.1.1 | 30 192.168.1.3 | 192.168.1.2 | 20 192.168.1.2 | 192.168.1.3 | 20...

mysql inner join query with multiple boolean conditions

mysql,sql,select
I have following two tables Table 1: creatives creative_id creative_name 1 xyz 2 pqr 3 abc Table 2: term_relationships creative_id term_id 1 1 1 2 1 3 2 1 2 2 2 4 3 1 3 2 3 3 I want to join the above 2 tables to get query...

how to retrieve select option from php?

php,select,option
I am calling selected value twice in php instead of once..please anyone solve my problem?? Html part: <select name="mol[]" > <option value="">Choose Mode of License</option> <option value="standalone">Standalone</option> <option value"wan">WAN</option> <option value"lan">LAN</option> </select> php code: echo "<td>"; echo "<select name='mol' class='mol'> <option value='$row[mol]'>$row[mol]</option> <option value='standalone'>Standalone</option>...

PHP: While loop not working after adjusting SELECT for SQL injection prevention

php,mysql,select,sql-injection,associative-array
I am trying to set up PHP queries for MySQL in a way to prevent SQL injection (standard website). I had a couple of INSERT queries where changing this worked well but on the following SELECT I keep getting an error since the update and it looks like the while...

Create MySQL temporary table and select from it within PHP

php,mysql,select,temp-tables
I need an advice with a PHP/MySQL code I am writing. What I need to do is to create a temp table and then select from it. Problem is that the temp table only lasts during the query that created it so the second query in PHP is empty. Here...

Select where max date

sql,sql-server,select,max
I want to select the last note from notes with the following query: SELECT cn.Note, MAX(cn.Date) FROM CarsNote cn WHERE CustomerID = '80' AND cn.Type = 'INFO' GROUP BY Note When I execute this query i get four results but i want only the last note. When i do SELECT...

Formatting dates in PostgreSQL

sql,postgresql,select,date-formatting
I have a field which its format is date with time as: YYYY-MM-DD HH-MM-SS for example: 2000-08-12 00:00:00 I want to get just the date part and change its format to DD/MMM/YYYY for example the expected result of the previous example will be: 12/Aug/2000 The field definition is: Ddate timestamp...

Firefox dropdown menu click

html,firefox,select,drop-down-menu
I have a dropdown menu for languages in my website and it works fine in Google Chrome, Safari and Internet Explorer, but it is bugged in Firefox. This is the code: <a href=""> <select id="languageSelector" style="background-color: transparent" onchange="location = this.options[this.selectedIndex].value;"> <option value=".">ESPAÑOL</option> <option value="./en/index.html">ENGLISH</option> <option value="./de/index.html">DEUTSCH</option> <option...

a simple select input is not working properly with angular-meteor

angularjs,select,meteor,angularjs-ng-repeat,angular-meteor
this is a weird thing: using angular-meteor library put a simple select input on the page: <div id="category"> <select ng-model="selectedItem"> <option ng-repeat="p in inputCategories" value="{{p.name}}"></option> </select> </div> select itself shows up, it has the correct number of options, but the actual option text is invisible! When inspected, it shows the...

Does FD_ISSET() return the file descriptor which received data

c++,c,linux,sockets,select
I have the following code fd = listen_socket(INADDR_ANY, CLIENT_PORT, client_config.interface); fdr = raw_socket(client_config.ifindex); if (fd >= 0) FD_SET(fd, &rfds); if (fdr >= 0) FD_SET(fdr, &rfds); max_fd = fd > fdr ? fd : fdr; retval = select(max_fd + 1, &rfds, NULL, NULL, &tv); if (FD_ISSET(fd, &rfds)) { .... } else...

AngularJS Filter two select inputs with values less than or equal to value

javascript,angularjs,select,filter,compare
I would like to setup two select inputs so that the combined value of either select input should be less than or equal to a specific value. Newbie to the AngularJS world so I may have overlooked something. I assume a filter but it might be ng-change that I should...

Javascript - return dynamic row data with checkbox input

javascript,forms,select,checkbox,tabular
I seem to only be able to find the answer to this problem in JQuery and I would really like a pure JS solution. I have a dynamically generated table that I build from a parsed JSON file. I added a checkbox for each row. My question is, do I...

Search table based on linked text field from second table

mysql,sql,select,join
Not being an SQL wiz at all, browsing through the results here, I was unable to find a proper solution, although the problem itself is fairly simple. Two tables: products id title strings id language_en An entry in products may look like this: id = 1 title = 10 Corresponding...

Selecting Account Numbers with latest date

sql,select,join,subquery
I have been trying to solve this problem now for days. I have table called Stat with the following simplified structure and sample data: Customer BankID AccNumb Type Date Amount AccType Customer 1 Boa 5 Account Statement 2015-01-01 10000,00 Eur Customer 1 CS 10 Account Statement 2015-04-04 22000,00 Eur Customer...

MySQL select from 2 tables without having “shared” key

mysql,select
Searched the site and found some similar questions, but none of solutions worked in my case. I have 2 tables - clients and memberships. The structure is following: clients client_id other_fields... memberships membership_id client_id other_fields... The field submitted to form is "membership_id". Let's say submitted value is 5. I want...

Understanding cartesian product in SQL

mysql,sql,select,join,cartesian-product
I am not able to understand how Cartesian product works. Consider the simple schema: mysql> select * from account; +----------------+-------------+---------+ | account_number | branch_name | balance | +----------------+-------------+---------+ | A101 | Downtown | 500 | | A102 | Perryridge | 400 | | A201 | Brighton | 900 | |...

f.select losing value when editing Rails 4

html,ruby-on-rails,forms,ruby-on-rails-4,select
I have an f.select in the new article page, and it works fine. However, when I edit the article, the value changes back to whatever is first in the options. Is there a way to keep the select value so users don't have to worry about redoing that when editing...

Select2 with Ajax + PHP

php,jquery,twitter-bootstrap,select
I am trying to use select2 pulling data using ajax from php back end. I could not figure out the documentation as much as I would like to. I think i probably missed some taken for granted stuffs. Please can you help with a simple example. I started or like...

How to perform boolean addition on an SQL select

sql,sql-server,select,sum,boolean
I have the following data in a database table column named timeSchedule 00100110 00010100 00110000 00110011 Boolean addition would result in 00110111 Is there a way to do this in sql? Something like select sumboolean(timeSchedule) from myTable Someone asked for DDL+DML.. here is an example: CREATE TABLE [dbo].[myTable]( [musPracticeID] [int]...

Type error calling select Standard ML

sockets,select,sml
I'm trying to call Socket.select to deal with some sockets. It seems like the following minimal snippet from my code should work... fun descs ss = map Socket.sockDesc ss fun selecting server clients = let val { ss, ws, cs } = Socket.select { rds = descs [server], wds =...

how to sum a field from 3 tables and display the results together

sql-server,select,sum
im using sql server and I have 3 tables called accnt, acc1152, and acc1167. each of these tables has an amnt field and a accno field with a few thousand records in it. i need to sum the entire amnt column for acc1152 and acc1167, then sum the amnt column...

Groovy: run SQL SELECT LIKE from file with params

sql,select,groovy
The groovy code is import groovy.sql.* dbUrl = 'jdbc:sqlserver://server' dbUser = 'username' dbPassword = 'password' dbDriver = 'com.microsoft.sqlserver.jdbc.SQLServerDriver' sql = Sql.newInstance(dbUrl, dbUser, dbPassword, dbDriver) def sqlfromfile = new SqlFromFile() sqlfromfile.sql_filename='select_query.sql' sqlfromfile.read() try{ def result = sql.rows(sqlfromfile.result,[id:'01']) println result }catch(e){ println e } class SqlFromFile { def sql_filename def read(){ result=...

Combining two select statements

sql,database,select,where
I have two statements as such: var chgAssociationQuery1 = (from a in sostenuto.PROBLEMS join b in sostenuto.S_ASSOCIATION on a.SERVICEREQNO equals b.FROMSERVICEREQNO join c in sostenuto.Changes on b.TOSERVICEREQNO equals c.SERVICEREQNO where b.FROMSERVICEID == 101001110 && b.TOSERVICEID == 101001109 && a.NAME.Contains(name) select new { ProblemReqNo = a.SERVICEREQNO, ProblemId = a.SERVICEREQID, ChangeReqNo =...

PHP - Find File in Directory By File Name [closed]

php,select,directory,filenames
I have a directory full of filenames that contain unix timestamps. file_1434320602.data file_1434320352.data file_1434320112.data file_1434320032.data How would I get about loading them up in PHP so that I can select the one which I needed?...

is it possible select the hit field of the search query

mysql,sql,select
I need to search on both from_a and from_alt fields, but should select only the hit field(field which matches with search criteria) as from_airport sample table : +--------+-----------------+ | from_a | from_alt | +--------+-----------------+ | FRA | BER,MUQ | | JFK | CAL,FRA | +--------+-----------------+ sample query for normal selection:...

How can I add FOR UPDATE to a cakephp3 query?

select,transactions,sql-update,cakephp-3.0,isolation-level
Is there a way to add FOR UPDATE to a find (SELECT) query in cakephp3? I found this hack: http://bakery.cakephp.org/2012/04/14/SELECT-FOR-UPDATE-hack-kind-of-ugly-but-it-works-PostgreSQL-and-MySql.html but it does not work since the limit value must contain only of a number. Another discussion on a similar topic can be found under https://github.com/cakephp/cakephp/issues/3136#event-213462937....

display number of elements depending on option selected

javascript,jquery,select,options
I'm trying to add a 3rd filter to track/display the number of elements shown depending on the option selected (#filter9). This is what I have so far, I got the code from: Filter based on combination of multiple select and single select elements. This is what i'm trying to edit:...

Append selected list elements into textarea, add own text

javascript,angularjs,select,textarea
On the basis of this post : Angularjs select elements from list and display in textarea I would like to add functionality : Fill textarea on the basis of chosen elements from the list. Add additional text inserted by user -> when user decides that he/she wants to add element...

Sqlzoo SELECT within SELECT Tutorial #5

sql,select
My Question is: Germany (population 80 million) has the largest population of the countries in Europe. Austria (population 8.5 million) has 11% of the population of Germany. Show the name and the population of each country in Europe. Show the population as a percentage of the population of Germany. My...

Autoupdating Field Based on two