我有两个表,如 A 和 B。表 A 具有列名称。具有列公司名称的表 B。
这是我的代码:
$query1 = "SELECT Name FROM A";
$query2 = "SELECT Company Name FROM B";
$statement1 = $connection->prepare($query1);
$statement2 = $connection->prepare($query2);
$statement1->execute();
$statement2>execute();
while ( ($name) = $statement->fetchrow_array) {
push (@Name, $name);
}
while ( ($companyname) = $statement->fetchrow_array) {
push (@companyName, $companyname);
}
open (FH, ">>Output.csv") or die "$!";
我需要像这样在csv文件中写入数据
Name CompanyName
xxx yyyy
xxx yyyy
xxx yyyy
xxx yyyy
xxx yyyy