Sad Der
accessd666 at yahoo.com
Fri Feb 25 01:25:28 CST 2005
I found the solution myself. SELECT deal_num FROM ess_gaspositionrecon_report WHERE deal_num in ( SELECT deal_num FROM tTest group by deal_num, tran_num) group by deal_num having count(deal_num) > 1 Now all I need to figure out is why it works as it works...:-) Thnx anyway! Regards, Sander --- Sad Der <accessd666 at yahoo.com> wrote: > Hi group, > > I need help with a query. > Here's a table with the columns tran_num and > deal_num > and here are some values: > tran_num deal_num > 10 1 > 10 1 > 11 1 > 12 1 > 13 2 > 14 3 > 14 3 > (the data is correct...there are about 50 more > columns > in the table!) > I need a query that returns all deal_no with > different > tran_no attached to it. > That means that the query should only return > Deal_num > 1. > Not deal_num 3 because that has the same tran_num > (14) > twice. > > I came up with this simple one: > SELECT deal_num, count(tran_num) > FROM ess_gaspositionrecon_report > group by deal_num > having count(tran_num) > 1 > > But this one returns deal_num 1 and 3. > > TIA > > Regards, > sander > > > > __________________________________ > Do you Yahoo!? > Yahoo! Sports - Sign up for Fantasy Baseball. > http://baseball.fantasysports.yahoo.com/ > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail