tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <misste...@gmail.com>
Subject Re: help!! why UNION of multiple tables is not working
Date Tue, 12 Jul 2005 20:46:24 GMT
The question is about the <sql:tag> cos I have queried the database
and tables with the same "select union of multiple tables" statement
and it works. I used JDBC in JSP and it works. Only when put into a 
<sql:query> does it not work. So I think the problem is with the tag
or the libraries am using. I just need to figure out what exactly is
stopping it from displaying the right fields.  Am I missing any other
dependencies?

i have tomcat5, servlet-api 2.4, jstl 1.1, J2SE 1.4
jsp-api-2.0.jar  jstl-1.1.0.jar standard-1.1.0.jar 
jsf-api-1.1_01.jar jsf-impl-1.1.jar  servlet-api.jar
xalan-2.6.0.jar  xercesImpl-2.6.2.jar 

On 7/12/05, Don Albertson <Don.Albertson@verizon.net> wrote:
> Dave Butler wrote:
> > Don Albertson wrote:
> >
> >> missterie@gmail.com wrote:
> >>
> >>> Yes..I have. I mean for example, when you do a simple query like this
> >>> Select 1,2,3 UNION Select 4,5,6, it should display all rows for all
> >>> select statements but it only displays 3,6.
> >>>  I thought a UNION could be used for multiple tables with unrelated
> >>> data, as long as am selecting the same fields or number of fields?
> >>
> >>
> >>
> >>
> >> What happens if you replace the sql tags with scriptlet code that
> >> creates a Connection, a Statement, executes the query text and returns
> >> the ResultSet?  Does that returned ResultSet contain what you expect?
> >>
> >>
> >>
> >>
> >>>
> >>>
> >>> On 7/12/05, McCormack, Chris <Chris.McCormack@littlewoods.co.uk> wrote:
> >>>
> >>>> Have you checked the row coming back from t2 exists in t1 also ?
> >>>> That would explain only one row being returned.
> >>>>
> >>>> -----Original Message-----
> >>>> From: missterie@gmail.com [mailto:missterie@gmail.com]
> >>>> Sent: 12 July 2005 15:30
> >>>> To: taglibs-user@jakarta.apache.org
> >>>> Subject: help!! why UNION of multiple tables is not working
> >>>>
> >>>>
> >>>> I have Tomcat 5.0, Servlet 2.4, jstl and standard taglibs 1.1.
> >>>> And all the required dependencies.
> >>>> I want to get a UNION of multiple tables
> >>>>
> >>>> so like
> >>>>   <sql:query dataSource="" var="row">
> >>>> SELECT name, user, addr from t1
> >>>> UNION
> >>>> SELECT name, user, addr from t2
> >>>>
> >>>> </sql:query>
> >>>>
> >>>> However, the UNION of  multiple tables does not bring forth the right
> >>>> result. It displays the last table fields. In this case, only
> >>>> field in t2.
> >>>> Is this a jstl and standard taglin issue or does this
> >>>> have to do with the fact that I have mysql version 3.23?
> >>>>
> >>>> I am still trying to understand how these taglibs work.
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> >>>> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> >>>>
> >>>>
> >>>>
> >>>> *****************************************************************************
> >>>>
> >>>> This e-mail and its attachments are confidential and are intended
> >>>> for the above named recipient only. If this has come to you in
> >>>> error, please notify the sender immediately and delete this e-mail
> >>>> from your system. You must take no action based on this, nor must
> >>>> you copy or disclose it or any part of its contents to any person or
> >>>> organisation. Statements and opinions contained in this email may
> >>>> not necessarily represent those of Littlewoods Group Limited or its
> >>>> subsidiaries. Please note that e-mail communications may be
> >>>> monitored. The Registered Office of Littlewoods Group Limited and
> >>>> its subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
> >>>> Registered number of Littlewoods Group Limited is 5059352.
> >>>> *****************************************************************************
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> This message has been scanned for viruses by BlackSpider MailControl
> >>>> - www.blackspider.com
> >>>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> >>>
> >>>
> >>
> >>
> > Is it not UNION ALL ?
> >
> 
> Might be.  My understanding of the difference is that if there is a row in the
> first SELECT's results which matches a row from the second SELECT's results then
>  UNION shows only one of the rows while UNION ALL shows both of them.  Though
> if the question is about SQL and not about the <sql:...> tag it should probably
> be labeled [OT].
> 
> 
> 
> 
> --
> In the elder days of art
> Builders wrought with greatest care
> Each minute and unseen part
> For the Gods are everywhere.
> Longfellow.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message