sql,postgresql,select,date-formatting
You can use the to_char function to format your column: SELECT TO_CHAR(ddatte, 'dd/Mon/yyyy') FROM mytable ...
I have to head out but if your data looks like this with the ID column: +---------+----------+----+ | word | number | ID | --------------------------- | jack | 1 | 1 | | jack | 2 | 2 | | jack | 3 | 3 | | ali | 1...
From the POSIX standards reference page on select: FD_ISSET(fd, fdsetp) shall evaluate to non-zero if the file descriptor fd is a member of the set pointed to by fdsetp, and shall evaluate to zero otherwise. So exactly what the result of FD_ISSET (which is really not a function but a...
sql-server,select,group-by,inner-join,distinct
You can use ROW_NUMBER with a PARTITION BY clause to identify duplicates: ;WITH CTE AS ( SELECT ROW_NUMBER() OVER (PARTITION BY ITEMNUMBER ORDER BY ROWNUMBER DESC) AS rn, 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...
sql,postgresql,select,max,psql
This is a classic usecase for the group by clause to return only distinct combinations of athlete and category. Then, max(points) could be applied to each combination: SELECT athlete, category, MAX(points) FROM mytable GROUP BY athlete, category ...
The good news is that your query is perfectly legal (and straight forward!) ANSI SQL, that will work on any sensible database. The bad news is that MS Access which you're using does not support this syntax. It can be worked around with a subquery, though: SELECT t.date, COUNT(*) FROM...
rs.wasNull() is meant to be used for verifying the last read column is NULL or not. If your table's first column is a primitive data type like int it will not return NULL. So in this case you need to verify if the query returns any row or not. For...
You are almost there. Both likelihood and impact vars contain the HTML element. You only need to get the value when you are checking if they are a number. window.update = function() { var likelihood = document.getElementById('likelihood'), impact = document.getElementById('impact'), final = document.getElementById('final'); if (isNaN(likelihood.value)) { return; } if (isNaN(impact.value))...
Here is what you want: SELECT Calendar_Month, CASE WHEN Series = 'FULL' THEN 'YOUR_TEXT_FOR_FULL' WHEN Series = 'NONE' THEN 'YOUR_TEXT_FOR_NONE' END AS 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 ...
I don't know if this is what you are looking for, btw not the best solution. jsfiddle $(".selectoption").on("change", function(event){ $(event.target).attr("disabled", false); $(event.target).next().attr("disabled", true); $(event.target).prev().attr("disabled", true); }); ...
mysql,sql,select,join,cartesian-product
A Cartesian join joins every record in the first table with every record in the second table, so since your table has 7 rows and it's joined with itself, it should return 49 records had you not had a where clause. Your where clause only allows records where a's balance...
You should use R-vectorized feature to subset data. No need to use a for-loop here. For example: Data[Data$Date == "01/01/2001",] ## Date A B ## 2 01/01/2001 0.1374231 10 Of course you can wrap this in a function: subset_by_date <- function(date_txt,Data) Data[Data$Date == date_txt,] PS : in you function you...
sql-server,tsql,select,case,inner-join
Try this, it should work SELECT *, CASE WHEN p.currencyid=0 THEN 140 ELSE p.currencyid END FROM projects AS p INNER JOIN businesssectors AS bs ON bs.businesssectorid=p.businesssectorid INNER JOIN plants AS pl ON p.plantid=pl.plantid LEFT OUTER JOIN currencies AS c ON c.currencyid=p.currencyid WHERE p.projectid='195' ...
You can use union all (or union, it depends on what you want to get in case Status1 and Status2 are the same): select ID, Name, Status1 as Status from tbl union all select ID, Name, Status2 from tbl SQLFiddle...
Not sure what you're trying to do with the NULL there, but basically you if you want to find a capital that contains the name of the country, the usage of the like operator is definitely in order. Just slap a couple of wildcards (%) around it, and you should...
python,select,pandas,leap-year
Here is an example to do that in a vectorized way. You shall note that and and or are not appropriate for a vector of booleans, use & and | instead. import pandas as pd import numpy as np s = pd.Series(np.random.randn(600), index=pd.date_range('1990-01-01', periods=600, freq='M')) Out[76]: 1990-01-31 -0.7594 1990-02-28 -0.1311...
The question was incomplete and was taken from here This is the answer SELECT name, CONCAT(ROUND((population*100)/(SELECT population FROM world WHERE name='Germany'), 0), '%') FROM world WHERE population IN (SELECT population FROM world WHERE continent='Europe') I was wondering about sub-query as from OP'S question it wasn't clear (at least to me)....
html,firefox,select,drop-down-menu
Why is your code surrounded by an a-Tag (<a href=""></a>) ? If you click on the content (e.g. your dropdown) the href="" reload the page. Remove the a or change href="" to href="#".
Using least would be much easier: SELECT LEAST(SUM(my_field), 86400) FROM my_table ...
sql,sql-server,sql-server-2008,select,escaping
You can escape a single quote (') with another single quote - two in total (''). Note that this is not the double quote character ("), which is a single character, but two single quote characters (' and then another '): SELECT make,model FROM Cars WHERE model = 'CEE''D' ...
Use loop and generate a select box //firs create an array with your options $options[] = array( 'standalone' => 'Standalone', 'wan'=>'Wan', 'lan'=>'Lan' ); //if already selected store the key to a variable $selected = @$row['mol']; echo "<select name='mol' class='mol'>"; //generate select box foreach($options as $op => $key) { if($selected ==...
You shouldn't be trying to set anything like that using jQuery when using knockout - instead, do it all on the viewmodel. Your <select> options are bound to your issuingCountries observableArray, and the value selected is bound to your IssuingcountrySelected observable. To select an option automatically, just set the property...
select,transactions,sql-update,cakephp-3.0,isolation-level
You can do it with Query::epilog() $selectQuery->...->epilog('FOR UPDATE'); ...
You can use a Regular Expression: regexp_substr('Hazel/Green==F123==Brown','(==F.+?==)') extracts '==F123==', now trim the =: ltrim(rtrim(regexp_substr('Hazel/Green==F123==Brown','(==F.+?==)'), '='), '=') If Oracle supported lookahead/lookbehind this would be easier... Edit: Base on @ErkanHaspulat's query you don't need LTRIM/RTRIM as you can specify to return only the first capture group (I always forget about that). But...
jquery,select,drop-down-menu,html-select
You can select the element by it's attribute and value. alert($('#products option[value="6"]').attr('price')); Demo: http://jsfiddle.net/tusharj/rhf0q9nt/ Docs: https://api.jquery.com/attribute-equals-selector/ EDIT Thanks to @satpal: Use data-* prefixed custom attributes to store arbitary data on element. HTML <select id="products"> <option value="2" data-price="60.00">Product 1</option> <option value="4" data-price="40.00">Product 2</option> <option value="6" data-price="40.00">Product 2</option>...
sql,sql-server,select,join,where
The conceptual order of query processing is: 1. FROM 2. WHERE 3. GROUP BY 4. HAVING 5. SELECT 6. ORDER BY But this is just a conceptual order. In fact the engine may decide to rearrange clauses. Here is proof. Lets make 2 tables with 1000000 rows each: CREATE TABLE...
javascript,function,select,options
Something like this? (function (){ var parent = document.getElementById("MediaCategory"); for(var i=0; i< parent.children.length; i++){ var child = parent.children[i]; if(child.text === "Archive") { parent.removeChild(child); } } })(); ...
jquery,select,hide,html-select
If you can go with removing it, this seems to work in all browsers: $('select[name*="boxes"] option[value="box6"]').remove(); Tested in FF, Chrome, Safari, IE and Opera. Demo Fiddle...
In your sql condition may be wrong i think, i modified that sql. select p.* FROM products p JOIN strings s ON p.title = s.id and s.language_en = "Product name" you can execute and see the result. Thank you....
You would do this with a group by and having. You really provide no information about your data structure, but the basic idea is: select ip.item from design ip where ip.property in ('wheel', 'red', 'tire') group by ip.item having count(distinct ip.property) = 3; ...
javascript,jquery,select,options
Here is working demo just a basic filter to apply filter9 on how many li elements to show https://jsfiddle.net/xd2482f6/6/ Instead of pasting all your code which you can get from the JS fiddler i will just add in changes made. <select id="filter9" > <option value="-1" > all</option> <option value="1"> 1</option>...
Use the ~ character like so: data[~data.ip.str.contains(':')] ...
maybe so .select { border: 1px solid #ccc; overflow: hidden; height: 40px; width: 240px; position: relative; display: block; } select{ height: 40px; padding: 5px; border: 0; font-size: 16px; width: 240px; -webkit-appearance: none; -moz-appearance: none; appearance: none; } .select:after { content:"\f0dc"; font-family: FontAwesome; color: #000; padding: 12px 8px; position: absolute; right:...
Use the starts with selector ^= like jQuery('[id^="sus-"]').btsConfirmButton({msg:"I'm sure!"}, function(e) { d_manage('delete','<?= $D->d->id?>');$(this).slideUp(); }); ...
One way to do this is to count the number of matching terms and check it sums up to the number of matches you want: SELECT * FROM creatives WHERE creative_id IN (SELECT creative_id FROM term_relationship WHERE term_id IN (1, 2, 3) GROUP BY creative_id HAVING COUNT(*) = 3) ...
The problem isn't in the join, you also have to fully specify the column in the SELECT statement as well, or it won't know which of the BUYER_ID columns to display. Change it to SELECT BUYER.BUYER_ID and it will work.
php,arrays,loops,select,multidimensional-array
You are getting this output because you are overwriting the keys in your array. You would need to save to another array (aka not 2-dimensional): <?php $tbl = "TranslationsMain"; $conn = new mysqli($servername, $username, $password, $dbname); if($conn->connect_error){ die("Connection failed: " . $conn->connect_error); } $sql = "SELECT * FROM " ....
sql,postgresql,select,distinct-values
You can use the distinct modifier in the count function: SELECT COUNT(DISTINCT p_id) FROM mytable ...
Ok, this is not good style but it might get you what you want. Assuming your times are strings and you are confident that plain string comparison would work for you, you could do something like this: timesteps = ncfile.variables['time'] dates_to_skip = set(['June 23th', 'May 28th', 'April 1st']) filtered_timesteps =...
html,ruby-on-rails,forms,ruby-on-rails-4,select
Instead of params[:category] you should provide selected: :category in the options_for_select(<...>).
javascript,angularjs,select,filter,compare
You can create an object which represents your two inputs. $scope.inputs = { 'A': 0, 'B': 0 }; Use an ng-change to call a function which checks the sum of all inputs and makes sure they are less than the max value. <select ng-model="inputs.A" ng-options="number for number in numbers" ng-change="verifySum('A');"></select>...
php,mysql,select,sql-injection,associative-array
You cannot bind column and table names, only data. You need to specify the table and then bind for your '%calendar weekday%'. $stmt = $conn->prepare("SELECT " . $selectLang . " FROM `TranslationsMain` WHERE `location` LIKE ? ORDER BY `sortOrder`, " . $selectedLang); $stmt->bind_param('s', $calendar_weekday); ...
ruby-on-rails,ruby,ruby-on-rails-4,select
In your User model add a method : def user_dispay_name "#{email}(#{full_name})" end Now do : <%= select_tag 'receiver', options_from_collection_for_select(@user, 'id', 'user_dispay_name') %> ...
sql,sql-server,select,sum,boolean
OK, Now that we have the DDL (unfortunately without the DML but only one row). we can provide a solution :-) firstly! I highly recommend NOT TO USE the solution above, THERE IS NO NEEDS for loops even you not use fixed data length we know the max len (50)....
Try to this 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 = c.SERVICEREQNO, ChangeId =...
Your ON (id = stat_students_avg) does not correspond the same value . The only way that stat table can be joined to the class table is the class_trainerid of the class table and trainer_id of the stat table You could try something like this SELECT class_id , class_name, class_trainerid, class_starttime...
You're using setupController to feed data into the controller. And you set the counties property to a promise returned by store.find(). When the page loads, Ember does not wait for that promise to resolve. Thus, the select box appears with no entries, and the query params entry is considered non-existing...
UNION ALL SELECT field1, field2, field3 FROM table1 WHERE condition UNION ALL SELECT field1, field2, field3 FROM table2 WHERE condition; Or to simplify your WHERE condition SELECT * FROM ( SELECT field1, field2, field3 FROM table1 UNION ALL SELECT field1, field2, field3 FROM table2 ) WHERE condition; ...
Because you are not changing the selection of the button - (IBAction)ChangeColorButton:(UIButton*)sender { //self.shouldChangeColor = sender.selected; sender.selected = !sender.selected; //If you do this if(sender.selected) { self.shouldChangeColor=YES; NSLog(@"Switch is ON"); //Make it off now //sender.selected=NO; You Don't have to do this [self randomColor];//If you want to change the color when switch...
android,sql,sqlite,select,android-sqlite
String literals in SQL are denoted by single quotes ('). Without them, and string would be treated as an object name. Here, you generate a where clause title = Test. Both are interpreted as columns names, and the query fails since there's no column Test. To solve this, you could...
Use CASE: select CASE WHEN from_a like 'FRA%' THEN from_a WHEN from_alt like 'FRA%' THEN from_alt END as from_airport from details where from_a like 'FRA%' or from_alt like 'FRA%'; If both fields match, then from_a takes precedence over from_alt....
There is no MAX or GROUP BY. It is just: SELECT TOP 1 cn.Note, cn.Date FROM CarsNote cn WHERE cn.CustomerID = '80' AND cn.Type = 'INFO' ORDER BY cn.Date desc; ...
In Oracle and SQL-Server you can use ROW_NUMBER. name = month name and num = month number: SELECT sub.name, sub.num FROM (SELECT ROW_NUMBER () OVER (PARTITION BY name ORDER BY num DESC) rn, name, num FROM tab) sub WHERE sub.rn = 1 ORDER BY num DESC; ...
I Assumed that you are using SQL this a generic query for your question: SQLCommand cmd = new SQLCommand(); cmd = "SELECT DEPT_ID FROM PERSONNEL_TEMP.DEPARTMENT WHERE DEPARTMENT_NAME= '" + combobox1.Text + "'"; here is what I recommend SQLCommand cmd = new SQLCommand(); cmd = "SELECT DEPT_ID FROM PERSONNEL_TEMP.DEPARTMENT WHERE DEPARTMENT_NAME=...
For your particular example, you could use this where clause: where $query like concat('%', name, '%') ...
You can sum the items in each table to get the total sum and then cross join both aggregate results to table2: UPDATE table2 SET InvAmnt = sum1 * InvAmnt / sum2 FROM table2 CROSS JOIN (SELECT SUM(cost) AS sum1 FROM table1) t CROSS JOIN (SELECT SUM(InvAmnt) AS sum2 FROM...
php,jquery,twitter-bootstrap,select
In data() function you must pass 'term' as a key instead of select_proj. $('select').select2(); $("#select_proj").select2({ ajax: { url: '../app/select_prj.php', dataType: 'json', delay: 250, data: function (term, page) { return { term: term, // search term page: 10 }; }, processResults: function (data, page) { return { results: data.items }; },...
javascript,angularjs,select,textarea
Here's a working jsfiddle doing what you ask. Every time you click on a list element it is appended to the textarea. The main function is a generic directive that you can reuse across controllers: myApp.directive('txtArea', function() { return { restrict: 'AE', replace: 'true', scope: {data: '=', model: '=ngModel'}, template:...
try this SELECT in.*,out.*,Day FROM (SELECT expand(both('Friend').outE('isGoing')[Day = 29]) FROM #12:0) ...
You cannot refer to aliases in the select list (or the where clause, for that matter). One way around this is to use a subquery: SELECT starting_principle, interest, principle + interest AS principle_plus_interest FROM (SELECT 50000 AS starting_principle, .065*50000 AS interest FROM some_table) t ...
sql,sql-server,select,insert-into
You can only use one target table for each insert statement. therefore, keeping field1 as null seems like the easy way to go: INSERT INTO [#Temp] SELECT ID, CASE WHEN ID IN (ID1, ID2, ID3...) THEN Field1 END FROM [Other_table] the case statement will return null id the ID is...
Forgot to post this, redid the code with prepared statements and it works, not sure what exactly I changed but here it is anyhow: $jobnumber = $_GET['jref']; $stmt = $conn->prepare( "SELECT `Job Name`, `Address`, `phone`, `description`, `materials` FROM po_10152796 WHERE po = ?"); $stmt->bind_param("i", $jobnumber); if($stmt->execute()){ $stmt->bind_result($jobname, $address, $phone, $description,...
You could just set fdMax to the maximum file descriptor value supported by your system (which may be represented by FD_SETSIZE), and not worry about it, but it may cause inefficiencies. select will use the fdMax value as a hint of when it can stop its linear scan of the...
In Oracle 12, you can do: 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, lastname order by count(*) desc fetch first 1 row only; In older versions, you can do...
I'm not sure why you're seeing the results you are, but mathematically your expected result is just 1 - Delta: SELECT SnapshotDay ,SnapshotHour ,(1 - Delta) as Adjust FROM #Difference If Delta is positive it will be substracted from 1: (1 - Delta) If Delta is negative the absolute value...
SELECT 'acc1167' as tbl_name,SUM(amnt) FROM acc1167 union SELECT 'acc1152' as tbl_name,SUM(amnt) FROM acc1152 union SELECT '1167' as tbl_name,SUM(amnt) FROM accnt WHERE ACCNO = '1167' union SELECT '1152' as tbl_name,SUM(amnt) FROM accnt WHERE ACCNO = '1152' ...
mysql,select,transactions,cakephp-3.0
Since it's working fine for me, I would suspect that you have an additional query outside of the transactional callback, which also looks for id = 2, as the query being generated by your shown find() call will never be executed, since queries are being lazy evaluated. For now you've...
sql,sql-server,select,subquery,sql-server-2000
Always use table aliases, especially with correlated subqueries. You think your query is: SELECT t1.* FROM MY_DB.dbo.MY_TABLE1 t1 WHERE t1.MY_PROBLEMATIC_COLUMN IN ( SELECT t2.MY_PROBLEMATIC_COLUMN FROM MY_DB.dbo.MY_TABLE2 t2 ) But, because t2.MY_PROBLEMATIC_COLUMN does not exist, SQL avoids an error and looks for a column in an outer scope. The query is...
swift,select,uisegmentedcontrol
From the Apple Documentation Content for each segment is set individually. Using the Segment field, you can select a particular segment to modify its content. So you can not choose multiple segments into Segmented Control. For more information read that document....
javascript,forms,select,checkbox,tabular
You can try something like //use this to store the mapping of values, assuming loadid is unique for each record else a unique property of the record has to be used var watchlogic = {}; var watchLog = new XMLHttpRequest(); watchLog.onreadystatechange = function () { if (watchLog.readyState === 4) {...
sql,sql-server,database,select,join
I think you want this kind of scenario Retrieve Drug_ID from Given Criteria (Brand_Name , Drug_Id, Generic Name) Select Record on base of That Retrieved Drug_ID SELECT distinct(Company_List.Company_Name), Drug_Details.* from Drug_Details , Company_List where Company_List.Company_ID=Drug_Details.Company_ID and Drug_Details.Drug_ID in ( select distinct(Drug_Details.Drug_ID) from Drug_Details where Drug_Details.Brand_Name like '%arnica%' or Drug_Details.Drug_ID in...
Try this: SELECT f.f_name FROM faculties f WHERE (SELECT COUNT(1) -- Here we get the student count for the faculty FROM students s WHERE f.f_numb = s.faculty_numb) > (SELECT COUNT(1) -- Here we get the CS faculty student count FROM students s JOIN faculties f ON (f.f_numb = s.faculty_numb) WHERE...
The problem here is you want to count by a different grouping than you want to display. One way around this is two have the counting in a subquery: SELECT DISTINCT product, type FROM mytable WHERE product IN (SELECT product FROM mytable GROUP BY product HAVING COUNT(DISTINCT type) > 1)...
You can make an arbitrary decision to represent the the "smaller" IP address first and the "larger" second. From there on, it's a simple group by and sum: WITH t1 AS ( SELECT LEAST(source_ip, distination_ip) AS ip1, GREATEST(source_ip, distination_ip) AS ip2 , usage FROM receiver ) SELECT ip1, ip2, SUM(usage)...
The correct answer is the second, because A is a primary key and a primary key cannot be null, so A > 50 OR A <= 50 will always be true, while the following: B > 50 OR B <= 50 might be NULL if B is NULL NULL >...
wrap ip address passed to mysql with single quotes, use actual table name. if your resulting array is blank, then you are missing that ip from your table.
Try adding the following to the end: and exists(select * from memberships m where m.membership_id = 5 and m.client_id = clients.client_id ) ...
php,html,select,drop-down-menu
It is because you aren't ending the value attribute, so your selected option becomes <option value="optionvalueselected" -- 'optionvalue' being the value of your selected option, and 'selected' being the attribute you want to set, but won't be set because you never ended value The following should work: <select name="course_id" id="course_id">...
sql,sql-server,sql-server-2008,select
In SQL-Server could be something like that: WITH cte AS ( SELECT Col FROM set1 WHERE Col = '' OR Col LIKE'+%' AND (CAST(REPLACE(REPLACE(Col,'+',''),'-','') AS INT) > 125) ) SELECT * FROM cte UNION ALL SELECT Col FROM set2 WHERE Col LIKE '%._' OUTPUT: '' -- blank +135 1.1 SQL...
php,select,directory,filenames
There are many ways you can do it. The simplest in this case is glob: $files = glob('/path/to/file_*.data'); print_r($files); ...
try this SELECT * FROM [db].[dbo].[TABLE] WHERE [ID] LIKE '%'+convert(varchar(50),:id)+'%' ...
jquery,forms,select,text,options
If you specifically know that you want to change the second option element within the select, you can target it with :eq(): $('.myclass option:eq(1)').text('TWO'); Note that eq() works on a zero-based index, so 0 is the first element, 1 is the second and so on....
This is not a matter of getting the data, it's a matter for presenting it properly using your list box. Your current implementation uses the default ToString; you want a custom title, so you need to tell the list box how to get it. Here is one way of doing...
java,select,selenium,selenium-webdriver,html-lists
Following should help - driver.findElement(By.id("personal")).findElement(By.id("dropDownArrow")).click(); driver.findElement(By.xpath("//li[contains(text(),'Manage your einstein™ Account')][@class='translate']")).click(); ...
json,codeigniter,select,insert,routing
You want to return json object in response, so it's required to set json type in response header. As given here public function select(){ $data['query'] = $this->users->select(); $this->output ->set_content_type('application/json') ->set_output(json_encode($data['query'])); } It is required to encode part as below for insert part. so you can use this generated url to...
sql,string,oracle,select,substring
Assuming you just want to split a column down the middle, you can achieve this with a combination of substr and length: SELECT SUBSTR(column_value, 1, LENGTH(column_value) / 2), SUBSTR(column_value, LENGTH(column_value) / 2 + 1) FROM mytable SQLFiddle...
angularjs,select,meteor,angularjs-ng-repeat,angular-meteor
The text given inside option tag will shown in your option. You missed to add text inside option tag. Markup <select ng-model="selectedItem"> <option ng-repeat="p in inputCategories" value="{{p.name}}">{{p.name}}</option> </select> ...
sql,oracle,select,sql-optimization
You could have several sum calls over case expression in t2, and then join that to t1: SELECT sum1, sum2 FROM t1 JOIN (SELECT c1, SUM(CASE WHEN c3 = 'NEW' AND c4 = TRUNC(SYSDATE) AND c5 = 'N' THEN c1 ELSE NULL END) AS sum1, SUM(CASE WHEN c3 = 'OLD'...
You may have to define your own function.Here is an example I just tested, hope it is helpful to you(BTW: It is not advisable to implement such kind of functions in mysql. Maybe it is better to let the application servers to compute it instead of mysql :)). DELIMITER $$...
php,jquery,database,select,data
Try this, It may help you. I have used JQuery Ajax. Also include JQuery library before use the below code. $('#myselect').change(function(){ var size = $('#myselect').val(); if(size != ''){ $.ajax({ type:'post', url:"/index.php/average_incomes_by_customer/" + size, cache:false, success: function(returndata){ console.log(returndata); //"returndata" is the result got from the DB. Use it where you want....