SQL w/ oracle

Started by
2 comments, last by ju2wheels 18 years, 8 months ago
Ive got everything connecting and working correctly with my java app intereacting with my database, but i now have a weird syntax issue with my sql statement generated by my frontend application. Say I have the following tables: TABLE1 ======= 1Col1 1Col2 1Col3 TABLE2 ======= 2Col1 2Col2 2Col3 TABLE3 ======= 3Col1 3Col2 3Col3 TABLE4 ======= 4Col1 4Col2 4Col3 Now lets say I use the following select statement: SELECT 1Col1, ..., 4Col3 FROM DB.TABLE1, DB.TABLE2, DB.TABLE3, DB.TABLE4 WHERE 1Col1 <> 'someVal' AND ... OR 4Col3 <> 'someVal' *... = random columns in between Now I get the following error: java.sql.SQLException: ORA-00918: column ambiguously defined This doesnt happen when I select columns from 2 or less tables. Its when I get into selecting a large number of columns from different tables that it has issues. Are they supposed to be kept in a specific order or something?
Advertisement
I haven't actually used oracle before, but are you sure you can select the columns of all of those tables without joining them? Are you doing 4 different queries by any chance?
What happens when you making smaller queries?
Heck, why *do* you have such a massively huge query of crossproducts?!? Use the JOIN command!!!
No its all one query. What are joins? err ill look it up. thanks for the suggestion.

This topic is closed to new replies.

Advertisement