This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
hi all i am retrieving data from three tables, i am getting duplicate values how to avoid these duplicates my query is
select url,title, b.ticket_name, b.networkcommission, c.commision from group_partner a,price b,partner_ticket_commision c where a.partnerid=3809 and a.partnerid=c.partnerid and evt_id=13840;
Originally posted by vamshi vamshi: there is no relation price and group_partner tables am just retrieving data using partnerid and eventid
If there is no relation then I would suggest make a seperate call for price table.
Shailesh
vamshi g
Greenhorn
Joined: Sep 12, 2008
Posts: 26
posted
0
ok lets take another query,
select a.url,a.title, b.ticket_name, c.commision , c.price_id, c.eventid from group_partner a,price b,partner_ticket_commision c where a.partnerid=3809 and c.partnerid=a.partnerid and c.price_id=b.price_id and b.evt_id=c.eventid and b.evt_id=43176.
in this i am getting 2 records,but url and title is repeates in 2 rows, any solution to avoid duplicates.
I have not tested it, so I can not promise it will work
SELECT A.URL, A.TITLE, D.PARTNERID, D.TICKET_NAME, D.COMMISION , D.PRICE_ID, D.EVENTID FROM GROUP_PARTNER A, (SELECT C.PARTNERID PARTNERID, B.TICKET_NAME TICKET_NAME, C.COMMISION COMMISION, C.PRICE_ID PRICE_ID, C.EVENTID EVENTID FROM PRICE B, PARTNER_TICKET_COMMISION C WHERE C.PRICE_ID=B.PRICE_ID AND B.EVT_ID=C.EVENTID AND B.EVT_ID=43176. ) D WHERE A.PARTNERID = D.PARTNERID AND A.PARTNERID=3809
Shailesh
vamshi g
Greenhorn
Joined: Sep 12, 2008
Posts: 26
posted
0
with out joining that two tables is there is any other way to restrict duplicates.
That's a database. What SQL did you run? Can you cut and paste your query so we can see it?
vamshi g
Greenhorn
Joined: Sep 12, 2008
Posts: 26
posted
0
My query is :
select a.url,a.title, b.ticket_name, c.commision , c.price_id, c.eventid from group_partner a,price b,partner_ticket_commision c where a.partnerid=3809 and c.partnerid=a.partnerid and c.price_id=b.price_id and b.evt_id=c.eventid and b.evt_id=43176.
Are you sure? Typically, when a database reports a syntax error it reports the exact text that caused the error. I don't see PARTNERID any where in your query, though you do have a.partnerid and the like. How are you running your query? Via JDBC or directly in a SQL client?
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.