how to skip duplicate zsql results?
i have a simple zsql (select * from table) which returns a list of items. The problem is that it returns identical items. Ie 1. item 1 2. item 1 3. item 2 How can i make it skip/omit the second duplicate entry. Below is the code. <SELECT name="item"> <OPTION tal:repeat="table here/getTableMethod"><SPAN tal:replace="table/item">Some Item</SPAN></OPTION> </SELECT> Thanks, Wayne __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
isn't there a UNIQUE statement in SQL? Anyway...you should fix your SQL your data in the database. -aj --On Dienstag, 29. Juli 2003 21:00 Uhr -0700 Wayne Connolly <wayne_connolly@yahoo.com> wrote:
i have a simple zsql (select * from table) which returns a list of items.
The problem is that it returns identical items. Ie 1. item 1 2. item 1 3. item 2
How can i make it skip/omit the second duplicate entry. Below is the code.
<SELECT name="item"> <OPTION tal:repeat="table here/getTableMethod"><SPAN tal:replace="table/item">Some Item</SPAN></OPTION> </SELECT>
Thanks, Wayne
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
I think the easiest solution here would be to incorporate a GROUP BY clause into your SQL query. I don't think it's really correct to consider these "duplicate" items, as that implies erroneous representation of the information. If you are unfamiliar with GROUP BY clauses, a google on the subject should be enlightening. Edward Wayne Connolly wrote:
i have a simple zsql (select * from table) which returns a list of items.
The problem is that it returns identical items. Ie 1. item 1 2. item 1 3. item 2
How can i make it skip/omit the second duplicate entry. Below is the code.
<SELECT name="item"> <OPTION tal:repeat="table here/getTableMethod"><SPAN tal:replace="table/item">Some Item</SPAN></OPTION> </SELECT>
Thanks, Wayne
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Thanks Edward and Andreas for you speedy and perfect answers. This fixed it up superbly. Im banging my head on my mysql manual now..thanks agani :-) --- Edward Pollard <pollej@uleth.ca> wrote:
I think the easiest solution here would be to incorporate a GROUP BY clause into your SQL query.
I don't think it's really correct to consider these "duplicate" items, as that implies erroneous representation of the information.
If you are unfamiliar with GROUP BY clauses, a google on the subject should be enlightening.
Edward
Wayne Connolly wrote:
i have a simple zsql (select * from table) which returns a list of items.
The problem is that it returns identical items. Ie 1. item 1 2. item 1 3. item 2
How can i make it skip/omit the second duplicate entry. Below is the code.
<SELECT name="item"> <OPTION tal:repeat="table here/getTableMethod"><SPAN tal:replace="table/item">Some Item</SPAN></OPTION> </SELECT>
Thanks, Wayne
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
Change your query to read *select distinct * from table* Cheers, Mike On Wed, 2003-07-30 at 00:00, Wayne Connolly wrote:
i have a simple zsql (select * from table) which returns a list of items.
The problem is that it returns identical items. Ie 1. item 1 2. item 1 3. item 2
How can i make it skip/omit the second duplicate entry. Below is the code.
<SELECT name="item"> <OPTION tal:repeat="table here/getTableMethod"><SPAN tal:replace="table/item">Some Item</SPAN></OPTION> </SELECT>
Thanks, Wayne
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Andreas Jung -
Edward Pollard -
Michael Long -
Wayne Connolly