Archive for the ‘mysql’ Category

On transferring a Magento website Database running on MySQL 5.7.34 to MariaDB 10.2.39, I get the following error: [naveenos@server2 etc]# mysql m1_db < db.sql ERROR 1005 (HY000) at line 4080: Can't create table `catalog_product_relation`...

Magento provides lot of inbuild functionalities. Using "protected function _prepareColumns()" function we can create or add new column to the grid. Like: protected function _prepareColumns() { $this->addColumn('first_name',...

Zend provides a facility to delete a row from the database table using the delete() method. This method takes one argument, which is an SQL expression that is used in a WHERE clause, as criteria for the rows to delete. For example : $modelObj = new...

To view any changes in php.ini file or some LAMP server files we should restart the apache server again.  and you can do this by following commands: sudo /etc/init.d/apache2 stop sudo /etc/init.d/apache2 start Above both commands will stop the...

In some cases we need to remove old entries from the database or remove entries before specific days. So mysql provides the syntax to delete records: DELETE FROM $table_name WHERE $date_field < date_sub(CURDATE(), $numberOfDays day) If above...

Sometimes we written a code to enter some dynamic entry in the table but did not want to enter duplicate records for same id ( not primary field). and we found that we have entered many records in the table and not it is not possible to delete record...

many times we need to do operation on two column values and show in the admin panel. for this we have to follow these steps: 1. Add column in your Grid.php file: 2. Now create a folder in the AdminHtml folder with name 'Renderer' 3. Create a...

Mostly all Models in the Magento have a corresponding Collection object that can be used to fetch multiple instances of a Model. To instantiate a Product collection, do the following $collection =...

Any developer wants to check what sql is executing during page load. so he can check and identify the getting errors: To print the sql go to folder : app\code\core\Mage\Catalog\Model\ and open file Layer.php search the function : and...

To create a site in multiple languages you should do two main things : Write this code after connection created in database file : mysql_query ( 'SET...

Joining two fields into one

June 15, 2010 | In: mysql

I want to get two fields value in a single value and I searched on net many times but today I try to solve at my behalf and I got the solution. Here you will get the solution to get the two fields value as single value: For example: Database : ...