Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Distinct SELECT to query multiple table
php_Boi wrote:
> Hi have a database with two table. the first table caled dates has a
> set of codes in a column called tcode(s) in a column that is not unique
> to allow for repeating entries (yes tables are normalized).
> +----------------+----------------+--------------+
> | code | startDate | endDate |
> +----------------+----------------+--------------+
> |XYZ | 2005-06-07 |2005-10-11 |
> +----------------+----------------+--------------+
> |XYZ | 2005-10-07 |2005-12-11 |
> +----------------+----------------+--------------+
> |ZZZ | 2005-06-07 |2005-10-11 |
> +----------------+----------------+--------------+
> i want to select only the distinct codes that match search criteria
> such as this:
> "SELECT DISTINCT code FROM dates WHERE startDate >= '2007-04-07' AND
> endDate <= '2005-10-11'
> The result is then something like
> XYZ,BBC,GED,PQR...
>
>>From there i have a second table called tripper>
> +----------------+----------------+--------------+
> | code | name | price |
> +----------------+----------------+--------------+
> |XYZ | super-skii |200 |
> +----------------+----------------+--------------+
> |XYZ | desert sun |10 |
> +----------------+----------------+--------------+
> |ZZZ | chicken run |50 |
> +----------------+----------------+--------------+
This is very obviously school work and you need to take this up with your instructor.
Please note also that '2007-04-07' is not a date and your LIKE condition, as written, contains at least two different errors.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Wed Jan 17 2007 - 08:35:08 CST