[thelist] MySQL Query problem: unique vals from two fields

Anthony Baratta anthony at baratta.com
Wed Nov 22 10:56:52 CST 2006


Sounds like you need a "view". Create a view using both tables and the Union selecting only the Date column. Then you can create a query that grabs the Unique Years.

http://dev.mysql.com/doc/refman/5.0/en/views.html

-----Original message-----
From: "Pringle, Ron" RPringle at aurora-il.org
Date: Wed, 22 Nov 2006 08:43:36 -0800
To: "theList \(E-mail\)" thelist at lists.evolt.org
Subject: [thelist] MySQL Query problem: unique vals from two fields

> I'm attempting to write a query that grabs unique Years from two date fields in the same table in a MySQL db (5.0.26 IIRC), preferably as a single column or as an array of results. I have a table of art exhibit start and end dates. I want to find all unique years from the exStartDate and exEndDate fields and use them to populate a dropdown for a search form.
 



More information about the thelist mailing list