aspose file tools*
The moose likes JDBC and the fly likes repeates each and everytime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

repeates each and everytime

vamshi g
Greenhorn

Joined: Sep 12, 2008
Posts: 26
hi
my query:
selecta.url,a.title, b.ticket_name, b.networkcommission, c.commision,d.user_id from group_partner a,price b,partner_ticket_commision c,user_profile d where a.partnerid=? and c.partnerid=a.partnerid and b.evt_id=c.eventid and b.evt_id=? and first_name=?


am getting the output,but some values are repeating,how to avoid this
thanks.
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Use joins.

Ananth Chellathurai


Ananth Chellathurai [Walk on software]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"select distinct" may be the easiest
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3775

You are not joining user_profile d in the where clause. Aren't there a connection between that table and the others used in the query. If so join that too.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36486
    
  16
"Vamshi g" you need to read your private messages pronto.
[ September 20, 2008: Message edited by: Campbell Ritchie ]
vamshi g
Greenhorn

Joined: Sep 12, 2008
Posts: 26
There is no connection between user_profile and other tables.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Originally posted by vamshi g:
There is no connection between user_profile and other tables.


Then you are in the same situation you were in here
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29241
    
139

Then let's close this thread and continue conversation in the other. No point in having two parallel discussions about the same thing.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: repeates each and everytime
 
Similar Threads
sql query returning duplicates
problem