Query in CENTOS

P { margin-bottom: 0.21cm; } i have installed CENTOS in VMware. I want the linux command to run in CENTOS.

The command is to select data's from Event table(our table name) convert into .xls and mail every 2hrs. Can you please help me in writing this script.

Thanks,
Shobana

I'm guessing you are talking about extracting data from a MySQL database and putting it into a spreadsheet?
In which case you'd start with a call to mysql:

mysql -d databasename -u username -ppassword -e 'SELECT datas FROM Event'

You'd then need to parse this data into a csv style format (piping the mysql into awk is a pretty easy way to get this done, but mysql might even have a csv output format option if you explore it's help pages)
Lastly, have a look round for csv to xls converters (or just stick with .csv format as excel will happily read that)

Thank you

---------- Post updated at 04:48 AM ---------- Previous update was at 12:12 AM ----------

Thanks for your reply............it was helpful.

But I have another query like how to fetch only particular data from database (MYSQL)(for ex: user and msg) for every 2hrs and convert into an .xls format.

How to write script for the below query?

$arrAcc="SELECT accountID FROM account";
$Accountid=$DB->Execute($arrAcc);

for($i=0;$i<=length($Accountid);$i++)
{
$arrDevice="SELECT deviceID FROM device";
$Deviceid=$DB->Execute($arrDevice); 
for($j=0;$j<=length($Deviceid);$j++)
{
$arrEvent="SELECT * FROM eventdata WHERE accountID=$i and deviceID=$j";
$EventData=$DB->Execute($arrEvent);  
}
$j++;
}
$i++;

Thanks,
Shobana