Hi, I'm making a join involving 5 tables, all with primary and foreign keys. For example, if one table has a unique empno(for employee table),another table(vacation) has many values for that same empno depending on the number of vacations that empno has taken.The unique primary key for vacation is say vacationno. Now, when I make the join (which involves getting personal information etc), based on the empno, I get multiple rows with the same data in it for an empno with mutliple entries in vacation table. If I try to use distinct in my select statement, I get an error saying : ORA-00920: invalid relational operator My question is, when I use distinct, does it hold good for only the first column immediately after it, or to all columns in the select statement ? And why am I getting the above error ? When I type the select statement without the distinct clause, it runs properly. With distinct, i get the error. Is there a way to get the desired result, ie, only one row in vacation table for multiple empno values ? I want to use empno as my selective criteria. Any suggestions will be very heplful. Thanks.
Hi Mallika... U got The Master Table...and Detail Table.... to get The Personal Info U r making..JOIN...rite.. just try.. Select e.empno,e.name from emp e,vac v where e.empno=v.empno and let me know... chio Raj
Joined: Feb 15, 2001
Hi, Thanks a lot Thomas and Raja. Wierd, but when I tried the query in sql+, it did not work. But when I tried it out with my java class, it worked !!!