SQL question



Hi, all.

I am working with Sybase AS IQ 12.6.

Situation - I have several tables, containing date fields:

table1(start_date, end _date, id1, id2)
table2(start_date, end _date, id1, id2)
table3(start_date, end _date, id1, id2)
table4(start_date, end _date, id1, id2)
table5(start_date, end _date, id1, id2)

I need to get minimal start_date value from all of those tables and
maximal end _date value
from all tables. Result would be longest data period, described by
those two fields across all tables.

It would be great, if I could solve at least this.

Final task is to get combination in such hierarchy : id1 ->id2 ->
period, like having selected longest time periods for each id2 and id1
combination (id1 and id2 is in one-to-many relationship)

Any helpful ideas?

Thanks!

.



Relevant Pages

  • SQL question
    ... I am working with Sybase AS IQ 12.6. ... Result would be longest data period, ... like having selected longest time periods for each id2 and id1 ...
    (comp.databases)
  • SQL question
    ... Actually, I am working with Sybase AS IQ 12.6, but hope that your SQL ... Result would be longest data period, ... like having selected longest time periods for each id2 and id1 ...
    (comp.databases.informix)
  • Re: SQL question
    ... Does SYBASE have the UNION operator? ... like having selected longest time periods for each id2 and id1 ...
    (comp.databases)
  • Re: Merging/Eliminating Redundant Columns
    ... WHERE ID1 is Null and ID2 is Null and ID3 Is Null ... I am creating a query from several different tables containing housing ...
    (microsoft.public.access.queries)
  • Recordset, findfirst langsam bei 2 Parametern mit AND oder OR
    ... Suche ich nach den ersten Datensatz egal ob ID1 oder ID2 bekomme ich das ... r.findfirst "ID1=23456" 'gibt es nur einmal in der Tabelle ...
    (microsoft.public.de.access.clientserver)