Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 problem in query

Author  Topic 

asifbhura
Posting Yak Master

165 Posts

Posted - 2008-04-06 : 04:52:02
hi,

SELECT news.id as id, A_date , title , hyperlink, filename , media_type , papername from news, paper where news.media_type = paper.id and news.a_date='06/04/2008' and media_type ='4'

this query is working fine but problem is it duplicates row.It displays all rows two time.

news Table:

id int IDENTITY(1,1)
logo ntext
A_date nvarchar(50)
E_date nvarchar(50)
Day nvarchar(50)
media_type int
Title ntext
Description ntext
Author nvarchar(254)
pages nvarchar(50)
email nvarchar(50)
Hyperlink ntext
filename nvarchar(50)
userid nvarchar(50)
IP nvarchar(50)
pub_no nvarchar(50)


Paper Table:

id int IDENTITY(1,1)
papername nvarchar(250)

Regards,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-06 : 05:30:42
Try using DISTINCT . If it still doesnt slove your problem, post your table structures along with sample data.

SELECT DISTINCT news.id as id, A_date , title , hyperlink, filename , media_type , papername from news, paper where news.media_type = paper.id and news.a_date='06/04/2008' and media_type ='4'
Go to Top of Page

asifbhura
Posting Yak Master

165 Posts

Posted - 2008-04-06 : 06:24:48
Hi,

Actually i imported database from MS Access.May be data structure hase been changed from its origin.

if i want to use DISTINCT how i can ?
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-04-06 : 10:41:10
Did you try what visakh has said ?
Go to Top of Page
   

- Advertisement -