Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem selecting multiple table with "UNION"

Status
Not open for further replies.

calypso13

Technical User
Nov 5, 2004
21
0
0
US
I have this statement in a JSTL tag. But it only displays
the last field "addr".
How do I select both tables or multiple unrelated (except for "user" field) tables
and display all data found on one page?
From what I read, the UNION is what am looking for, but its not working
right and am not sure what am doing wrong here.

Code:
<sql:query>
SELECT user, name, inform, addr from t1 where user='234' UNION 
SELECT user, name, inform, addr from t2 where user='234'
</sql:query>

thanks
 
your query looks fine

to determine where the problem is, run your query outside of your app, directly in mysql -- you will either get a more informative error emssage, or else it will work fine, so you will know your problem is in your app, not the query

r937.com | rudy.ca
 
calypso,

I'm getting this exact same problem in another database system. A JSTL bug perhaps.
 
I am connecting to a Basis database using JDBC (Basis driver). It works in commandline but not in a JSTL <sql:query>.
For testing purposes, I connected to a sample MySQL database using the sql-connector in Tomcat, used the same JSTL statement, and it works fine. So am thinking there is something else wrong with either the Basis driver or maybe it just doesnt support mySQL 4.0. Doesnt make sense to me though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top