| Author |
Topic  |
|
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 11/25/2006 : 23:31:39
|
Hello everyone,
I can not understand why this is happening like this..
I have a stored procedure on SQL Server 7.0 database which executes a select statement as shown below:
select e.UnivID, e.TumourID, e.Date_Diag, t.TumourName from [dbo].[Episode] AS e, [dbo].[TumourGuide] AS t
where e.UnivID = 1 and e.TumourID = t.TumourID order by e.Date_Diag DESC
On SQL Server 7.0 database, this gives me correct answer as 2 results.
But I also installed same database on SQL Express server and I executed same query I get 8 results instead of 2.
Does anyone can tell if there is anything wrong with my query or there is some change/bug in SQL Express server?
Thanks, Ujjaval |
|
|
snSQL
Flowing Fount of Yak Knowledge
USA
1837 Posts |
Posted - 11/25/2006 : 23:46:27
|
Do you get identical results on both servers if you run these two queries?
select e.UnivID, e.TumourID, e.Date_Diag
from [dbo].[Episode] AS e
where e.UnivID = 1
order by e.Date_Diag DESC
select t.TumourID, t.TumourName
from [dbo].[TumourGuide] AS t
where
order by TumourID |
Edited by - snSQL on 11/26/2006 15:45:45 |
 |
|
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 11/25/2006 : 23:54:23
|
Yes, I do get identical results. It happens when I include table TumourGuide in it. I can't understand that bit.
|
 |
|
|
snSQL
Flowing Fount of Yak Knowledge
USA
1837 Posts |
Posted - 11/26/2006 : 00:25:04
|
| For both queries I gave you, not just the Episode one? How many rows do you get for the Episode one? |
Edited by - snSQL on 11/26/2006 00:25:36 |
 |
|
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 11/26/2006 : 00:39:01
|
Oh sorry for that. I misunderstood.
With the episode query I get 2 results.
With the TumourGuide query I get 9 results.
-Ujjaval |
 |
|
|
snSQL
Flowing Fount of Yak Knowledge
USA
1837 Posts |
Posted - 11/26/2006 : 00:47:32
|
| You'll need to post the structure of the two tables and the results of those two queries I gave you too. |
 |
|
|
Kristen
Test
United Kingdom
22191 Posts |
Posted - 11/26/2006 : 02:56:17
|
How is that second query working at all?
select t.TumourID, t.TumourName
from [dbo].[TumourGuide] AS t
where
order by TumourID
I'm very curious as to how ujjaval's query could behave differently between the two versions of SQL Server
Kristen |
 |
|
|
snSQL
Flowing Fount of Yak Knowledge
USA
1837 Posts |
Posted - 11/26/2006 : 15:47:26
|
quote: How is that second query working at all?
My mistake 
I know - I'm pretty sure that there's just duplicate data, I don't think there is really any difference. |
 |
|
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 11/27/2006 : 01:47:21
|
Apologies to everyone. Sorry Kristen and snSQL, for TumourGuide query, I was confident enough that I wrote the ideal number of rows without running that query. But that was the table screwing me up. I ran it and there it is. TumourGuide table had duplicate data. That's why I was getting it like that. I am such a stupid.
But thanks for that.
Ujjaval |
 |
|
|
Kristen
Test
United Kingdom
22191 Posts |
Posted - 11/27/2006 : 04:23:22
|
| Glad you got it sorted out |
 |
|
| |
Topic  |
|