MySQL

Show result of MYSQL select query in two div according to column name, using a single select query

I have a table with column names id,name,category,title,news. Once select query executes i get all the required data from table but i need to split up this data into two div according to the category they belong. there are two different categories, say A and B. I need to show all the data with a column category name A in…
Read more

Execute query after 1 hour

Attached the table sample. What i am trying to achieve is on every hour it selects one media_id (id=1) and executes my code, then 2nd hour (id=2) and so on, How I can track which one to execute and whats the latest, Do I need to add a new table and save the current id or what? Really confused on…
Read more

#1248 – Every derived table must have its own alias

Please help me out SELECT mainmenu.mid FROM ( ( SELECT content_info.ContentID, content_info.Title, menu_list_article.MenuID as article_parent, subsubmenu.title as article_parent_title, submenu.sid, submenu.title as sid_title, mainmenu.mid, mainmenu.title as mid_title, mainmenu.module FROM `content_info` JOIN menu_list_article ON menu_list_article.ContentID = content_info.ContentID JOIN subsubmenu ON subsubmenu.ssid=menu_list_article.MenuID JOIN submenu ON submenu.sid=subsubmenu.sid JOIN mainmenu ON mainmenu.mid=submenu.mid WHERE menu_list_article.MenuID LIKE ‘SSMN%’ ) UNION ( SELECT content_info.ContentID, content_info.Title, menu_list_article.MenuID as article_parent,…
Read more

Formatting a date retrieved from MySQL [duplicate]

This question already has an answer here: Change date format in php retrieved from mysql 3 answers I am retrieving a date from my MySQL database in PHP using the current timestamp. I get an output: 2015-09-29 17:51:35 I expect this output: 29-september-2015 Source: mysql

Symfony2 sublevel query

I’m trying to get a list of flights from a search form. User picks a city, a number of passengers, and my query returns all available flights. I tried this one : public function findSearch($city, $nbpax) { $qb = $this->createQueryBuilder(‘a’); $qb->where(‘a.precisedate >= :now’) ->setParameter(‘now’, new DateTime()) ->andWhere(‘a.available > :min’) ->setParameter(‘min’, $nbpax) ->andWhere(‘a.departure > :min’) ->setParameter(‘min’, $nbpax) ->andWhere(‘a.departure.city = :city’) ->setParameter(‘city’,…
Read more

Add data in the 1st row of table using angular.js and PHP

I need to bind data in the 1st row of the table always after submitting the data into database using angular.js and php. I am explaining my code below. courseController.js: var courseApp=angular.module(‘GofastoHome’); courseApp.controller(‘coursecontroller’,function($scope){ $scope.buttonName=”Submit”; //console.log($scope.buttonName); var id=gup( “e_i” ); $.ajax({ type:’GET’, url:”php/readCourseData.php”, success: function(data){ $scope.$apply(function(){ $scope.courseData=angular.fromJson(data); }); } }) $scope.addCourseData=function(){ if($scope.coursename==null){ alert(‘course name field could not blank’); }else if($scope.course_short_name==null){ alert(‘short…
Read more

How to pass values of date chooser to database?

I tried to store a date in mysql by a Date Chooser from Netbeans. But it stores date as java.text.SimpleDateFormat@8629ad2d . This is the code I used… String dateselect; dateselect = dat.getDateFormat().toString(); I don’t know how to convert it to store as a date. Please help.. Source: mysql

Have a perforamance issue of query date object using Django queryset

I’m using django 1.8.4 writing a webapp . The backend uses MySQL. Recently the number of table records reaches 1M, the webapp responses slow. A test table contains now 1,478,911 records. The storage engine is MyISAM. Data volumn is 138MB. If I query all distinct date objects as a list, django will takes 1-1.5 seconds constantly, but using MySQL client,…
Read more

Not displaying array value php object inside array

Here is the var_dump array(2) { [0]=> object(Project)#346 (6) { [“errors”]=> NULL [“attributes”:”ActiveRecordModel”:private]=> array(5) { [“id”]=> int(10) [“project_id”]=> string(2) “13” [“note”]=> string(15) “To be fetched..” [“date”]=> string(10) “0000-00-00” [“author”]=> string(2) “11” } [“__dirty”:”ActiveRecordModel”:private]=> array(0) { } [“__readonly”:”ActiveRecordModel”:private]=> bool(true) [“__relationships”:”ActiveRecordModel”:private]=> array(0) { } [“__new_record”:”ActiveRecordModel”:private]=> bool(false) } [1]=> object(Project)#348 (6) { [“errors”]=> NULL [“attributes”:”ActiveRecordModel”:private]=> array(5) { [“id”]=> int(11) [“project_id”]=> string(2) “13” [“note”]=>…
Read more

sqoop error : java.io.IOException: java.sql.SQLException: Bad format for BigDecimal

Hi I am trying to import two table data from mysql to hdfs using sqoop command. command : sqoop import –connect jdbc:mysql://16.166.242.179:3306/organisation –username root -P –table emp –m 2 –boundary-query “select * from emp,dept where emp.deptno=dept.deptno” –target-dir /sqoop/output error : ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: java.sql.SQLException: Bad format for BigDecimal ‘CLARK’ in column 2. Source: mysql