You are here: Re: OUTER JOIN not working? « MsSQL Server « IT news, forums, messages
Re: OUTER JOIN not working?

Posted by kamin on 07/07/06 18:04

For the output, for each row in tyg_aging_service_matrix, I want to
return all the records for tyg_aging_due_dates

So in my example, there should be 10 rows returned. Their will be 8
created_date fields that are null when it's done. This is what i'm
trying to do.


kamin@yankeegroup.com wrote:
> rhaazy wrote:
> > Please post propper DDL and table creation scripts and some sample data
> > so that we may have a better understanding of the problem.
> Scripts are as follows:
>
> CREATE TABLE [dbo].[tyg_aging_due_dates] (
> [due_date] [smalldatetime] NOT NULL ,
> [object_type] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CS_AS NOT
> NULL
> ) ON [PRIMARY]
>
> -- Data
> insert into tyg_aging_due_dates (due_date, object_type)
> values ('2006-07-10', 'yg_report')
> insert into tyg_aging_due_dates (due_date, object_type)
> values ('2006-08-14', 'yg_report')
> insert into tyg_aging_due_dates (due_date, object_type)
> values ('2006-09-11', 'yg_report')
> insert into tyg_aging_due_dates (due_date, object_type)
> values ('2006-07-24', 'yg_decisionnote')
> insert into tyg_aging_due_dates (due_date, object_type)
> values ('2006-08-28', 'yg_decisionnote')
> insert into tyg_aging_due_dates (due_date, object_type)
> values ('2006-09-25', 'yg_decisionnote')
>
>
>
> CREATE TABLE #tyg_aging_service_metrics (
> [created_date] [datetime] NOT NULL DEFAULT (getdate()),
> [due_date] [smalldatetime] NOT NULL ,
> [res_ref_id] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CS_AS NOT
> NULL ,
> [object_type] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CS_AS NOT
> NULL) ON [PRIMARY]
>
> -- Data
> insert into #tyg_aging_service_metrics (created_date, due_date,
> res_ref_id, object_type)
> values ('7/1/2006', '2006-08-14 00:00:00', '1234', 'yg_report')
> insert into #tyg_aging_service_metrics (created_date, due_date,
> res_ref_id, object_type)
> values ('7/1/2006', '2006-09-25 00:00:00', '5524', 'yg_decisionnote')
>
>
> So you see my temp table only has two records. I want to return all
> the rows from the due_dates table regardless if they match those
> records in tyg_aging_service_metrics.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация