Different results in Query (SQL Server 2005) with PHP and Management Studio



Hey guys,
I have a query here that gives the right results in SQL Management
Studio but wrong results in PHP (using mssql libraries under FreeBSD
using FreeTDS)

The query is as follow:
SELECT ROW_NUMBER() OVER (ORDER BY count DESC), s.*
FROM (
SELECT ROW_NUMBER() OVER (ORDER BY t.field1), t.blah, ....,
(SELECT COUNT(field2) FROM x WHERE x.fieldx=t.fieldx) AS count
FROM table t
WHERE CONTAINS(t.field3,'"some stuff"')
) AS s

In this query, in management studio the results are the desired
results
however in PHP, the field count is like incremented and doesn't give
the right results..

for instance,
management studio:
count for many records go from 1 1 1 0 0 0 0 ...

in php
count for many records go from 3 3 3 2 2 1 1 0
where it shouldnt be that...

Any idea on that?

Thanks!
.



Relevant Pages

  • SQLCommand calls sp_executesql implicitly
    ... I am using SQLCommand object to create datasets and open data readers. ... I found that on various occassions the same query if I run in Management ... Studio runs instantaneously, but within code that query takes too long to ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Confused by mysqli
    ... When I started using MySQL with Perl back in 1998, ... fetch_assocon a query I prepared with bind variables, ... So I had it print out its eval string that it was trying to run. ... PHP will fail to run at all, because bind_result will not have enough ...
    (comp.lang.php)
  • Re: [PHP] PHP & MySQL Problem
    ... [PHP] PHP & MySQL Problem ... > actually there seems to be no problem with your query (besides that you ...
    (php.general)
  • Re: timestamp
    ... PHP newsgroup, and should be discussed in comp.databases.mysql). ... Then click on the Survey link."; ... your SQL syntax; check the manual that corresponds to your MySQL ... Your query fails because a datetime value needs to be in single quotes in the query, ...
    (comp.lang.php)
  • Re: [PHP] Architecture patterns in PHP
    ... 316 Query SHOW TABLES FROM `cake` ... 316 Query DESCRIBE `posts` ... Application and Templating Framework for PHP ... when they cache the results of reverse engineer the object model from ...
    (php.general)

Loading