Skip to Content.
Sympa Menu

freetds - [freetds] ODBC, MSSQL, FreeTDS inner join not returning data from second table

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Andrew Rousseau <andrew AT bluehousegroup.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] ODBC, MSSQL, FreeTDS inner join not returning data from second table
  • Date: Tue, 16 Sep 2014 15:07:40 -0400

I have FreeTDS installed on an Ubuntu 14.04 server. I am connecting to the
MSSQL database as follows:

$db = new PDO('odbc:Driver=FreeTDS; Server=<IP Address>; Port=1433;
Database=db_name; UID=user; PWD=password;');

I am running the following query:

SELECT c.*, ct.*
FROM Committee AS c
INNER JOIN CommitteeType as ct on c.CommitteeTypeID=ct.CommitteeTypeID
WHERE CommitteeID=$committee_id

Then I am running:

$statement = $db->prepare($query);
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_NAMED);

The resulting array is very much what would be expected except that the
values from the CommitteeType table are all empty. When I run the exact
same query in Navicat on the database I get values for everything from the
second table.

Is there something buggy about this driver?

I have tried many variations on the query syntax without any difference in
output. It appears that I can never get values from an inner joined table
regardless of which tables I am querying.

Anyone see anything I am missing or have experienced anything similar?




Archive powered by MHonArc 2.6.24.

Top of Page