View Single Post
  #6 (permalink)  
Old October 25th, 2004, 08:37 AM
dcb22 dcb22 is offline
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply...

Ok imagine this set-up:

TABLE A
table_a_id
table_a_title

TABLE B
table_b_id
table_a_id
table_b_datetime

TABLE C
table_c_id
table_a_id
table_c_datetime

TABLE D
table_d_id
table_a_id
table_d_datetime

OK please don't ask me why anyone would design a table like this because I know it breaks all 3rd normal form. OK each data item has one row in Table A and a row in one of either B, C or D.

I need to find a way of creating a join so I can order the data in B, C, D so that it is in date order and only data in the future (using col datetime in B, C, D).

The output I'm looking for is:
table_a_id
table_a_title
date_time (from the row in B, C or D)

I've tried to get my head around this from SQL website but struggling. I think the UNION kind of works but I can't then do the order/where I need.

If anyone could help, much apreciated,

cheers,

Dave

Reply With Quote