FAQ Database Discussion Community


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...

referencing mySQL query components

mysql,sql,select,alias
Is there a way to make reference to parts of a MySQL query within the same query? For example: SELECT 50000 AS starting_principle, .065*50000 AS interest, principle + interest AS principle_plus_interest The third column, principle_plus_interest in the query set gives me an error. Is there a way to code this...

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...

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...

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:...

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...

Selecting multiple values from a single LINQ Query

c#,linq,select
I am having issues selecting multiple values from a LINQ query. I Can actually get the results I am looking for but it's not how I would like it.. This is my query. var getMovie = from item in entList where item.EType() == "Movie" orderby item.Rating select new { item.Title,...

python - how to check whether some given date exists in netcdf file

python,date,select,netcdf
I read my timesteps from a netcdf file: timesteps = ncfile.variables['time'] Now I would like to know whether some given date (say, June 23th) exists in that list. If it does, I want to omit it. The netcdf file contains arbitrary dates. I have no clue how to do this...

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 =...

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...

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...

Nested SQL statement with AVG()

php,mysql,select
I have three tables I want to pull data from. One is a classes table that stores a list of classes offered including an id, time stamp, trainer id, start time, am/pm and the days a class is held. The trainer id is a foreign key that ties it to...

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()"...

Ember.js: select state not saved in URL when reload page

select,ember.js,ember-data
There are select on the page for choosing country and it's need to save selected value in URL. I declared query params in route-driven controllers. It's all work! If country select is changed then url also changed. Demo: http://output.jsbin.com/releza But if I reload page with some valid GET params then...

how to Select data from multiple tables with several conditions?

sql,oracle,table,select
There are tables FACULTIES (F_NUMB, F_NAME, F_TELEF) and STUDENTS (S_NUM, SURNAME, SPECIALITY, GROUP, FACULTY_NUMB). Please write SQL query to achieve faculties names in which the count of students are greater than in faculty “Computer science”. This is what i'm doing: select faculties.f_name, count(STUDENTS.S_NUM) from STUDENTS, FACULTIES where students.fac_num=FACULTIES.F_NUMB group by...

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...

Using Sum in If in Mysql

mysql,sql,select,sum
I want to select the sum of values of my_field. The unit of my_field is in seconds. I don't want to exceed 24 hours, so when it exceeds 24 hours, I want it to select 24*60*60 = 86400. SELECT IF(SUM(my_field) > 86400, 86400, SUM(my_field)) ... This solution doesn't seem to...

OrientDB - Result from 2 different tables

sql,database,select,orient-db
I have a database that has 2 V's classes ('User' that has 2 strings named Name and Surname ,'Cinema') and 2 E's classes ('isGoing' that has an Integer property named Day, 'Friend'). This select returns all the 'Cinema' that the 'Friend' of the initial Vertex are going on a specific...

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...

Adding multiple data in select option rails 4

ruby-on-rails,ruby,ruby-on-rails-4,select
I am using bellow code and function options_from_collection_for_select for generating options for user. <%= select_tag 'receiver', options_from_collection_for_select(@user, 'id', 'email') %> Above code generate bellow html: <select id="receiver" name="receiver" style="display: none;"> <option value="1">[email protected]</option> <option value="2">[email protected]</option> <option value="3">[email protected]</option> </select> But i want email with username, e.g...

How to create a SELECT query FROM “TABLE1 AND TABLE2”

sql,postgresql,select,join
I have a PostgreSQL database, with only SELECT permissions. In this DB there are two tables with the same structure (the same columns). I need to write several query in each table and join the results. There is a way for writing a query like this one? SELECT field1, field2,...

Condition on resultset of a select that return null or not null values-Java

java,sql,select,null
For an application,I am checking if a table is filled so that I can retrieve that from it; otherwise I will retrive from another table. For that, I use a select and checks if it has null values by wasnull(). If it does, I execute a query; otherwise, I execute...

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;...

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 | |...

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...

how select a dynamic id generated in php with jquery

jquery,select
this code generated in php id="sus- ... <--- is static and id="sus-d->id ?>" is my problem to select that <button class="btn btn-danger btn-xs" id="sus-<?= $D->d->id ?>" ><i class="icon-trash "></i></button> out put : id="sus-2131" so i want select all id's start with sus- with below function : jQuery('#sus-').btsConfirmButton({msg:"I'm sure!"}, function(e) {...

SQL Server query syntax with single quote

sql,sql-server,sql-server-2008,select,escaping
I have in my database KIA car model like CEE'D. How to write right syntax to get all car where model = CEE'D Now I am using semipart of model SELECT make, model FROM Cars WHERE model LIKE '%CEE%' But now I need to get by full model name. How...

Swift Segment Control how to select more than one segment

swift,select,uisegmentedcontrol
I have a Segment Control in my app, I want to user to be able to click multiple of the segments. I googled and could not find any about this and there was no checkbox in Xcode for something like 'Allow multiple selection'. I found that in objective-c you weren't...

How can I find get attribute of a select tag where value = something using jquery?

jquery,select,drop-down-menu,html-select
How can I get the price attribute's value where #products.option value = 6. <select id="products"> <option value="2" price="60.00">Product 1</option> <option value="4" price="40.00">Product 2</option> <option value="6" price="40.00">Product 2</option> <option value="8" price="40.00">Product 2</option> </select> ...

PHP: How to push Select results to multi-dimensional array (partially working)

php,arrays,loops,select,multidimensional-array
I am new to PHP and hope someone can help me with this. I have a Select query that returns (among others) the values from two columns in a db table, "ID" and "en". When getting the results from the Select I would like to store both these values for...

SQL INSERT INTO WITH SELECT query

sql,sql-server,select,insert-into
Not being experienced with SQL, I was hoping someone could help me with this. I have a empty temp table, as well as a table with information in it. My outline of my query as it stands is as follows: CREATE TABLE [#Temp] (ID Int, Field1 Varchar) INSERT INTO [#Temp]...

How to show data from database depending on user's choice from a select

php,jquery,database,select,data
I have to make a select and when user choose option from it, it should be displayed data from database based on this select. I can't use submit. It only should be displayed this select and when option is selected, to show data from this select. I'm new to jQuery...

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?...

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...

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...

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; ...

SQL Server query with case in select statement with multiple INNER JOINS

sql-server,tsql,select,case,inner-join
I have a query with returns a set of data about projects. The issue however is that some of the projects don't have a valid currency id. So i'm trying to build a query that will, if the currency id is 0, use the id 140 instead. This is what...

JQuery select input value from input text generate by php

php,jquery,select
i have this structure that i generate for each element finded by a search <?php foreach ($this->pneumatici as $pneumatico) :?> <div class="col-md-3 element-form"> <div class="input-group input-float"> <input type="hidden" name="codice" value="<?= $pneumatico->codice ?>" id="codice"> <input type="text" class="form-control" id="quantita" value="0" size="1" maxlength="2" <?php if ($pneumatico->quantita == 0){ echo "disabled" } ?> >...

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=...

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 * FROM WHERE Query isn't retrieving any results

mysql,select,mysqli,fetch
I'm using a SELECT * FROM "" WHERE "" = "" query and I'm not sure what I'm doing wrong with it. I'm trying to select an item based on its PO which is a completely unique identifier to one row in the table. Here's my process in doing so:...

change the content of a select option

jquery,forms,select,text,options
I'd like to change the text shown in a select form, without changing the HTML elements. This is an example: <select class="myclass" name="myselect"> <option value="0">1</option> <option value="1">2</option> </select> I would like to change the "2" string into "TWO", for example, like: <option value="1">TWO</option> I'm not able to select the right...

How to change the value with a select in SQL?

sql,sql-server,select,alias
I need to have an other value instead of FULL and NONE but I must do it in the select. SELECT Calendar_Month,Series,Cnt FROM T_Cust_Eom_n where TYP='REB' and Series='FULL' or TYP='REB' and Series='NONE' order by Series desc,Calendar_Month Can I do this with an as anyhow?...

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...

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...

jQuery - hide option element by value

jquery,select,hide,html-select
Trying to hide an option element from a list. I have tried several methods however, cannot seems to work. I need to call select by name as I cannot add ID or class. $('select[name*="boxes"] option[value="box6"]').hide(); here the fiddle: http://jsfiddle.net/q2nb08t6/ any suggestions?...

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...

Flag fields from table 1 that also bellowings to table 2

php,mysql,sql,select,join
I have two table (table1 and table2) where table2 is a subset of table1, what I am trying to do is a select statement that return a boolean if a field of tabl1 is also in the table2 For example: Table 1 has item1, item2, item3 and item4 Table 2...

PHP $wpdb Select?

php,mysql,wordpress,select
I could use some assistance with an sql query. I have a small 3 column table, id, ip, and birthday. id auto increments. I'm trying to select all birthdays that are associated with a specific ip, but I'm not sure if the SQL statement I wrote is correct. The var_dump...

SQL Oracle | How would I select a substring where it begins with a certain letter and ends with a certain symbol?

sql,oracle,select,substring
If I had this: NAME EYES==ID==HAIR Jon Brown==F9182==Red May Blue==F10100==Brown Bill Hazel/Green==F123==Brown ...and I wanted to create a new ID column with the ID alone, and I know that everyone's ID starts with an 'F' and will end at the '=' how would I select a substring from the compact...

Dynamically select from a dynamically generated dropdown

php,html,select,drop-down-menu
I have a dynamically generated dropdown list - list of course identifiers and names. On the basis of a variable, “assigned_course_id”, I would like to preselect the appropriate value from the dropdown list. My best attempt is as follows. Thanks in advance for your assistance. <select name="course_id" id="course_id"> <?php $assigned_course_id...

Merge results from two separate columns into one elongated column

sql,oracle,select
My table: ID Name Status1 Status2 ------------------------------------- 1 foo bar grain 2 bar foo sball 3 foo bar grain 4 far boo sball I need for it to actually come out like this: ID Name Status ------------------------------- 1 foo bar 1 foo grain 2 bar foo 2 bar sball 3...

Is there a way to count a number of distinct values? [duplicate]

sql,postgresql,select,distinct-values
This question already has an answer here: SQL to find the number of distinct values in a column 8 answers In PostgreSQL 9.4 I have a table: id p_id PK integer ----------------- 1 1 2 1 ............. 123122 2233 Is there a way to count all distinct p_id values...

I am using a select in form field. data is inserted properly but displayed id only instead of text

laravel,select
Create page <div class="form-group"> <label><b>STATUS</b></label> {!! Form::select('status', ['Draft','Published']) !!} </div> Index page @foreach($sliders as $slider) <tr> <td>{!! $slider->id !!}</a></td> <td>{!! $slider->status !!}</td> @endforeach Controller public function store(Slider $slider,CreateSliderRequest $request) { // $slider=$slider->lists('name','id'); $slider = $slider->create($request->all()); Session::flash('message', 'The...

How to select a range of my table

mysql,sql,select,range
I have a table like this: (Pay attention to the sequence numbers for every word) // tablename +---------+----------+ | word | number | ---------------------- | jack | 1 | | jack | 2 | | jack | 3 | | ali | 1 | | ali | 2 | |...

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...

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 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...

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...

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 and distribute the sum between records in another table

sql,sql-server,select,sum
I have a table whose records consist of minor inventory. I need to sum the cost of these records and distribute the sum in another table based on the price of the record. for example. say the sum of the inventory is is $1000, and I have 4 jobs in...

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....

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...

Calling SELECT * on a primary key versus an attribute in SQL

mysql,sql,select,primary-key
I am currently studying for a final and have a question about one of the practice problems. The problem states: Consider the following two SQL queries over the relation R(A,B) where attribute A is the primary key. Query 1: SELECT * FROM R WHERE B > 50 OR B <=...

no such column error - sqlite

android,sql,sqlite,select,android-sqlite
I get a strange error: E/SQLiteLog﹕ (1) no such column: Test 06-22 01:51:20.006 15089-15089/com.almas.mehr.sms E/AndroidRuntime﹕ FATAL EXCEPTION: main android.database.sqlite.SQLiteException: no such column: Test (code 1): , while compiling: SELECT * FROM groups WHERE title = Test at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1090) at...

Database Multiple select Query , Unable to Retrieve Desired Data

sql,sql-server,database,select,join
I have three Tables as given below , I want to search record on base of three Different cafeterias in Single query,I want to search record whether user give Brand_Name , Drug_Id, Generic Name It give same output I.E. all record of That Drug_ID ,I am new to Database, however...

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...

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...

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 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...

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...

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...

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...

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>...

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)));...

Knokout select : Set Selected Item by item name not value

jquery,select,knockout.js
i have a knockout select as following observable Array issuingCountries 0: ObjectCoordinatorRegion: "EU" Country: "Australia" CountryId: 14 Id: 1 2: ObjectCoordinatorRegion: "AU" Country: "Japan" CountryId: 16 Id: 2 html <select class="issuing_country" data-bind="options: issuingCountries, optionsText : 'Country', value:IssuingcountrySelected, optionsCaption:'---Select---', " > </select> My question , i have { Country: "Japan" }...

Customize a select with font-awesome

css,select,font-awesome
This is what I have actually: HTML <label class="select"> <select name="email" id="email"> <option>aaaa</option> <option>aaaa</option> <option>aaaa</option> <option>aaaa</option> <option>aaaa</option> <option>aaaa</option> </select> </label> CSS .cforms select { -webkit-appearance: none; -moz-appearance: none; appearance: none; } .select { position:relative; display: -moz-inline-stack; display: inline-block; vertical-align: middle; zoom: 1;...

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...

Sql string search

sql,string,search,select
This is my question: Find the capital and the name where the capital includes the name of the country. This is my answer: SELECT name,capital FROM world WHERE capital=concat(name,"NULL") I dont understand what should i do in the "WHERE" part. Should i do capital=concat(name,something?) or IN or LIKE? Can you...

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...

SQL Select Statement - Column Ambiguously Defined even when defining which table each column comes from

mysql,sql,select
I'm doing a beginners course on SQL and databases, and I'm trying to write a select statement that will join two tables on Oracle Apex. I'm using join...on... to do so. The two tables each have a column named the same, with the columns filled with matching values. Obviously, they...

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....

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 =...

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°...

How to see the table just modified in a script with Sql Developer

sql,oracle,select,plsql,oracle-sqldeveloper
I've this block in sql developer: begin delete from temp; insert into temp values (1); dbms_output.put_line('Done'); end; If I hit F5 the script runs fine. The table is updated with the value 1 and the "Script output" tab says 'Done'. However I would like to automatically visualize the table that...

SQL Optimization: query table with different where clauses

sql,oracle,select,sql-optimization
I have the following SQL query: SELECT ( SELECT SUM(c1) FROM t2 WHERE t1.c1 = t2.c1 AND t2.c3 = 'NEW' AND t2.c4 = TRUNC(SYSDATE) AND t2.c5 = 'N' ) SUM, ( SELECT sum(c2) FROM t2 WHERE t1.c1 = t2.c1 AND t2.c3 = 'OLD' AND t2.c4 = TRUNC(SYSDATE) ) SUM2 FROM...

select a row of matrix based on Date in R

r,function,select
I'm new in R.I have a small question. I want to select one row based on date. I write a function but it doesn't work.Here is my example. Thanks in advance for your help. Here my data sample: Example Date A B 1 01/01/2000 0.6765442 1 2 01/01/2001 0.1374231 10...

select only one row that has the highest count in sql

sql,oracle,select
I need to select one row only which has the highest count. How do I do that? This is my current code: select firstname, lastname, count(*) as total from trans join work on trans.workid = work.workid join artist on work.artistid = artist.artistid where datesold is not null group by firstname,...

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]...

group by access seperate column

sql,ms-access,select,group-by
I'm very new to SQL and have the following (seemingly simple) database query. I have a table containing all timetracking information for a set of employees: date employeeId timeIn timeOut 01/01/20 1355 12:00 4:00 01/01/20 1355 4:30 6:00 01/01/15 1234 9:00 12:00 02/01/15 5555 5:00 6:00 02/01/15 1111 1:00 4:00...

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...

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...

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...

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...

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:...

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!!...

Python pandas: Select columns that their content does not contain a value

python,select,pandas
I would like to do the opposite of this : data[data.ip.str.contains(':')] Any ideas?...

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...

Autoupdating Field Based on two