Re: join on 3 tables for asp output
From: Mike D (MikeD_at_discussions.microsoft.com)
Date: 10/29/04
- Next message: Bob Barrows [MVP]: "Re: join on 3 tables for asp output"
- Previous message: Mike D: "Re: join on 3 tables for asp output"
- In reply to: Bob Barrows [MVP]: "Re: join on 3 tables for asp output"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 29 Oct 2004 10:55:04 -0700
What am I missing? Shouldn't this return all rows from Tab_Lookup_Calendar
that are a Monday? Should be more than 11 rows? Could there be somthing
wrong with my SQL server?
SELECT dbo.Tab_Lookup_Calendar.dt, dbo.Tab_Inst_Schedules.Instrument_ID
FROM dbo.Tab_Lookup_Calendar LEFT OUTER JOIN
dbo.Tab_Inst_Schedules ON dbo.Tab_Lookup_Calendar.dt =
dbo.Tab_Inst_Schedules.WeekOf
WHERE (dbo.Tab_Lookup_Calendar.isWeekday = 1) AND
(dbo.Tab_Lookup_Calendar.DW = 2) AND
(dbo.Tab_Lookup_Calendar.dt <
DATEADD(dbo.Tab_Lookup_Calendar.M, 12, GETDATE())) AND
(dbo.Tab_Inst_Schedules.Instrument_ID = 1)
ORDER BY dbo.Tab_Lookup_Calendar.dt
"Bob Barrows [MVP]" wrote:
> Mike D wrote:
> > I have three tables. The table structure and sample data is
> > below(sorry for the length). I want a select that will retrieve all
> > Mondays since I am scheduling instruments for a whole week. Every
> > Instrument should have a row for every Monday that way I can show
> > that it hasn't been scheduled.
> >
> > Thanks for any help you can provide
> >
> > Mike
> >
> >
> >
> You've done a good job showing us what the data looks like. Now you need to
> show us what the desired results look like. On the face of it, you will need
> some outer joins (I'm assuming this is SQL Server, correct?)
>
> Bob Barrows
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>
- Next message: Bob Barrows [MVP]: "Re: join on 3 tables for asp output"
- Previous message: Mike D: "Re: join on 3 tables for asp output"
- In reply to: Bob Barrows [MVP]: "Re: join on 3 tables for asp output"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|