[Solved] PHP + MySQL Interval query last 1 month with sum problem

[ad_1] You don’t have $row[“mbsent”] in your SELECT clause of your query. Perhaps you meant: $sql = “SELECT SUM(mbsent) AS summ, mbsent FROM data WHERE datum < DATE_ADD(NOW(), INTERVAL -1 MONTH) AND user=”csib” GROUP BY mbsent”; But that doesn’t make any sense either… so not sure what you are going for here. Also, I think … Read more

[Solved] CONCAT in stored procedure returns null

[ad_1] The documentation says CONCAT() returns NULL if any argument is NULL. This is demonstrated by this example: http://sqlfiddle.com/#!2/d41d8/47037 You can find some documentation on working with nulls here: http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html 2 [ad_2] solved CONCAT in stored procedure returns null

[Solved] Inserting months and updating it with Amount

[ad_1] Here’s an example script on how to do it as I explained in the comments before. All you have to do is adept your database and output to it: <?php $costs = 180; //Total costs $month_costs = 30; //Costs per month $paid = 80; //Paid first & second month + 10 dollar / euro … Read more

[Solved] How to get Joomla users data into a json array [closed]

[ad_1] You are overwriting the $id variable and then you are not using it… It seems there’s a mess in there with the $title, $name and $id variables. Try this: <?php $sql = “SELECT * FROM `jos_users` LIMIT 0, 30 “; $response = array(); $posts = array(); $result=mysql_query($sql); while($row=mysql_fetch_array($result)) { $id=$row[‘id’]; //change here $name=$row[‘name’]; //change … Read more

[Solved] Mysql functions in zend 2

[ad_1] /* DB Adapter get and SQL object create */ $adapter = GlobalAdapterFeature::getStaticAdapter(); $sql = new \Zend\Db\Sql\Sql($adapter); /* Select object create */ $select = new \Zend\Db\Sql\Select(); $select->from(‘states’); $select->where->addPredicate( new \Zend\Db\Sql\Predicate\Expression( ‘TRIM(LOWER(state_name)) = ?’, ‘noida’ ) ); /* Select object convert to string and execute */ $queryString = $sql->getSqlStringForSqlObject($select); $result = $adapter->query($queryString, Adapter::QUERY_MODE_EXECUTE); 1 [ad_2] solved … Read more

[Solved] How to get non grouped-by columns in SQL statement (similar to in MySQL)

[ad_1] Below is for BigQuery Standard SQL and as simple as below #standardSQL SELECT ANY_VALUE(first_name) first_name FROM `project.dataset.table` GROUP BY age As you can see you were missing just aggregation function – it can be any – MAX, MIN, etc. I’ve chosen ANY_VALUE as an example You can test, play with above using some simplified … Read more

[Solved] How can I add “ON UPDATE CURRENT_TIMESTAMP” on a column at table creation or by alter table withoud defining its default value

[ad_1] ALTER TABLE t1 MODIFY COLUMN c1 TIMESTAMP NULL — the opposite is NOT NULL, which is implicitly set on timestamp columns DEFAULT NULL — no default value for newly-inserted rows ON UPDATE CURRENT_TIMESTAMP; 0 [ad_2] solved How can I add “ON UPDATE CURRENT_TIMESTAMP” on a column at table creation or by alter table withoud … Read more

[Solved] how to get result based on 10 minutes interval in mysql

[ad_1] i have found the solution by below query. select a.time_column,group_concat(a.destination order by ct desc) from (select case when time between ’00:00:00′ and ’00:10:00′ then ’00:10:00′ when time between ’00:10:01′ and ’00:20:00′ then ’00:20:00′ when time between ’00:20:01′ and ’00:30:00′ then ’00:30:00′ else ’00:00:00′ end as time_column , destination , count(destination) ct from click group … Read more