Click here to Skip to main content
15,904,926 members
Home / Discussions / Database
   

Database

 
QuestionQuestion abt self joined tables Pin
Rocky#12-Sep-06 20:04
Rocky#12-Sep-06 20:04 
AnswerRe: Question abt self joined tables Pin
Stephen McGuire13-Sep-06 12:14
Stephen McGuire13-Sep-06 12:14 
QuestionA question abt making the main page of DB application Pin
Rocky#12-Sep-06 20:00
Rocky#12-Sep-06 20:00 
QuestionMultiple Record Set Pin
Amit Kumar G12-Sep-06 14:20
Amit Kumar G12-Sep-06 14:20 
AnswerRe: Multiple Record Set Pin
Not Active13-Sep-06 3:20
mentorNot Active13-Sep-06 3:20 
QuestionUrgent Need Help....Rows to Columns Pin
Amit Kumar G12-Sep-06 8:53
Amit Kumar G12-Sep-06 8:53 
AnswerRe: Urgent Need Help....Rows to Columns Pin
Eric Dahlvang12-Sep-06 11:47
Eric Dahlvang12-Sep-06 11:47 
QuestionSQL Join problem! Pin
richiemac12-Sep-06 3:21
richiemac12-Sep-06 3:21 
Hi all,

Here's the problem...

I've got two tables, trains and trainarrivals. Each train has a link to two arrivals records. The first link is to the previous arrival record and the d=second is to the next arrivals record.

I'm trying to join the tables using,

select * from train LEFT OUTER JOIN trainarrivals<br />
ON train.PreviousArrival = trainarrivals.UniqueID<br />
OR train.NextArrival = trainarrivals.UniqueID<br />
ORDER BY train.UniqueID


so that when i get the trains with their arrivals links I will get one row for each train. Due to the fact that the next and previous arrivals are separate records in the trainarrivals table I get two records for each train.

My question is, is there any way to do this so I get only one record with both the next and previous arrival data together.

Thanks for the help in advance.

Rich
AnswerRe: SQL Join problem! Pin
Eric Dahlvang12-Sep-06 4:06
Eric Dahlvang12-Sep-06 4:06 
GeneralRe: SQL Join problem! Pin
richiemac12-Sep-06 5:05
richiemac12-Sep-06 5:05 
Questiondaynamic sql Pin
yazan_zahi12-Sep-06 2:10
yazan_zahi12-Sep-06 2:10 
AnswerRe: daynamic sql Pin
Amit Kumar G12-Sep-06 16:17
Amit Kumar G12-Sep-06 16:17 
Questionnulls in a DataTable Pin
hamidreza_buddy11-Sep-06 23:44
hamidreza_buddy11-Sep-06 23:44 
AnswerRe: nulls in a DataTable Pin
_AK_11-Sep-06 23:56
_AK_11-Sep-06 23:56 
AnswerRe: nulls in a DataTable Pin
albCode13-Sep-06 4:15
albCode13-Sep-06 4:15 
QuestionCode Error! Pin
Shahzad.Aslam11-Sep-06 23:18
Shahzad.Aslam11-Sep-06 23:18 
AnswerRe: Code Error! Pin
_AK_12-Sep-06 0:23
_AK_12-Sep-06 0:23 
QuestionAbout cursor in sqlserver 2000 Pin
yazan_zahi11-Sep-06 22:57
yazan_zahi11-Sep-06 22:57 
AnswerRe: About cursor in sqlserver 2000 Pin
Marek Grzenkowicz12-Sep-06 0:14
Marek Grzenkowicz12-Sep-06 0:14 
GeneralRe: About cursor in sqlserver 2000 Pin
Amit Kumar G12-Sep-06 16:23
Amit Kumar G12-Sep-06 16:23 
GeneralRe: Can I use Dynamic SQL in While Loop Pin
gopisant15-Apr-09 20:11
gopisant15-Apr-09 20:11 
Questionfetch data from table Pin
senthilmca11-Sep-06 19:21
senthilmca11-Sep-06 19:21 
AnswerRe: fetch data from table Pin
_AK_11-Sep-06 19:26
_AK_11-Sep-06 19:26 
AnswerRe: fetch data from table Pin
Amit Kumar G12-Sep-06 16:24
Amit Kumar G12-Sep-06 16:24 
QuestionProblem with SQL 2005 Express: View Sorting Order Pin
nguyenvhn11-Sep-06 18:38
nguyenvhn11-Sep-06 18:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.