Showing posts with label body. Show all posts
Showing posts with label body. Show all posts

Friday, February 17, 2012

DATEDIFF order by problem

Hello All,
Could any body tell me what the problem is with this select is giving
me:
(SQL Server 2000)
Server: Msg 156, Level 15, State 1, Line 23
Incorrect syntax near the keyword 'order'.
It runs fine when I take out the joins...
Any help is appreciated, here is the select:
____________________________________________
selectObj.serial,Obj.partnum, partlist.type, Obj.location,
Obj.datecreated, Obj.qty,
AgeInDays = DATEDIFF(DAY, Obj.datecreated, GETDATE()),
Cost.Cost, Cost.Material, Cost.Labor, Cost.Burden, Cost.Other
fromObj
joinPartlist
onObj.partnum = partlist.partnum
joinparts
onobj.partnum = parts.part
whereDATEDIFF(DAY, obj.datecreated, GETDATE())
order by
obj.location,
obj.partnum
______________________________________________
"Aenim" <mackdaddiee@.hotmail.com> wrote in message
news:1132267505.409803.158760@.g14g2000cwa.googlegr oups.com...
> Hello All,
> Could any body tell me what the problem is with this select is giving
> me:
> (SQL Server 2000)
> Server: Msg 156, Level 15, State 1, Line 23
> Incorrect syntax near the keyword 'order'.
> It runs fine when I take out the joins...
> Any help is appreciated, here is the select:
> ____________________________________________
> select Obj.serial, Obj.partnum, partlist.type, Obj.location,
> Obj.datecreated, Obj.qty,
> AgeInDays = DATEDIFF(DAY, Obj.datecreated, GETDATE()),
> Cost.Cost, Cost.Material, Cost.Labor, Cost.Burden, Cost.Other
> from Obj
> join Partlist
> on Obj.partnum = partlist.partnum
> join parts
> on obj.partnum = parts.part
> where DATEDIFF(DAY, obj.datecreated, GETDATE())
> order by
> obj.location,
> obj.partnum
> ______________________________________________
>
This line is incomplete:
where DATEDIFF(DAY, obj.datecreated, GETDATE())
Presumably you meant:
where DATEDIFF(DAY, obj.datecreated, GETDATE()) = ? ... something?
David Portas
SQL Server MVP
|||Well yes... I guess... but what do I need if I want all dates in that
table?
|||Aenim wrote:
> Well yes... I guess... but what do I need if I want all dates in that
> table?
In that case remove the WHERE clause altogether.
David Portas
SQL Server MVP
|||On 17 Nov 2005 15:26:17 -0800, "Aenim" <mackdaddiee@.hotmail.com>
wrote:
>Well yes... I guess... but what do I need if I want all dates in that
>table?
Omit the where clause!
J.

DATEDIFF order by problem

Hello All,
Could any body tell me what the problem is with this select is giving
me:
(SQL Server 2000)
Server: Msg 156, Level 15, State 1, Line 23
Incorrect syntax near the keyword 'order'.
It runs fine when I take out the joins...
Any help is appreciated, here is the select:
________________________________________
____
select Obj.serial, Obj.partnum, partlist.type, Obj.location,
Obj.datecreated, Obj.qty,
AgeInDays = DATEDIFF(DAY, Obj.datecreated, GETDATE()),
Cost.Cost, Cost.Material, Cost.Labor, Cost.Burden, Cost.Other
from Obj
join Partlist
on Obj.partnum = partlist.partnum
join parts
on obj.partnum = parts.part
where DATEDIFF(DAY, obj.datecreated, GETDATE())
order by
obj.location,
obj.partnum
________________________________________
______"Aenim" <mackdaddiee@.hotmail.com> wrote in message
news:1132267505.409803.158760@.g14g2000cwa.googlegroups.com...
> Hello All,
> Could any body tell me what the problem is with this select is giving
> me:
> (SQL Server 2000)
> Server: Msg 156, Level 15, State 1, Line 23
> Incorrect syntax near the keyword 'order'.
> It runs fine when I take out the joins...
> Any help is appreciated, here is the select:
> ________________________________________
____
> select Obj.serial, Obj.partnum, partlist.type, Obj.location,
> Obj.datecreated, Obj.qty,
> AgeInDays = DATEDIFF(DAY, Obj.datecreated, GETDATE()),
> Cost.Cost, Cost.Material, Cost.Labor, Cost.Burden, Cost.Other
> from Obj
> join Partlist
> on Obj.partnum = partlist.partnum
> join parts
> on obj.partnum = parts.part
> where DATEDIFF(DAY, obj.datecreated, GETDATE())
> order by
> obj.location,
> obj.partnum
> ________________________________________
______
>
This line is incomplete:
where DATEDIFF(DAY, obj.datecreated, GETDATE())
Presumably you meant:
where DATEDIFF(DAY, obj.datecreated, GETDATE()) = ' ... something?
David Portas
SQL Server MVP
--|||Well yes... I guess... but what do I need if I want all dates in that
table?|||Aenim wrote:
> Well yes... I guess... but what do I need if I want all dates in that
> table?
In that case remove the WHERE clause altogether.
David Portas
SQL Server MVP
--|||On 17 Nov 2005 15:26:17 -0800, "Aenim" <mackdaddiee@.hotmail.com>
wrote:
>Well yes... I guess... but what do I need if I want all dates in that
>table?
Omit the where clause!
J.

DATEDIFF order by problem

Hello All,
Could any body tell me what the problem is with this select is giving
me:
(SQL Server 2000)
Server: Msg 156, Level 15, State 1, Line 23
Incorrect syntax near the keyword 'order'.
It runs fine when I take out the joins...
Any help is appreciated, here is the select:
____________________________________________
select Obj.serial, Obj.partnum, partlist.type, Obj.location,
Obj.datecreated, Obj.qty,
AgeInDays = DATEDIFF(DAY, Obj.datecreated, GETDATE()),
Cost.Cost, Cost.Material, Cost.Labor, Cost.Burden, Cost.Other
from Obj
join Partlist
on Obj.partnum = partlist.partnum
join parts
on obj.partnum = parts.part
where DATEDIFF(DAY, obj.datecreated, GETDATE())
order by
obj.location,
obj.partnum
______________________________________________"Aenim" <mackdaddiee@.hotmail.com> wrote in message
news:1132267505.409803.158760@.g14g2000cwa.googlegroups.com...
> Hello All,
> Could any body tell me what the problem is with this select is giving
> me:
> (SQL Server 2000)
> Server: Msg 156, Level 15, State 1, Line 23
> Incorrect syntax near the keyword 'order'.
> It runs fine when I take out the joins...
> Any help is appreciated, here is the select:
> ____________________________________________
> select Obj.serial, Obj.partnum, partlist.type, Obj.location,
> Obj.datecreated, Obj.qty,
> AgeInDays = DATEDIFF(DAY, Obj.datecreated, GETDATE()),
> Cost.Cost, Cost.Material, Cost.Labor, Cost.Burden, Cost.Other
> from Obj
> join Partlist
> on Obj.partnum = partlist.partnum
> join parts
> on obj.partnum = parts.part
> where DATEDIFF(DAY, obj.datecreated, GETDATE())
> order by
> obj.location,
> obj.partnum
> ______________________________________________
>
This line is incomplete:
where DATEDIFF(DAY, obj.datecreated, GETDATE())
Presumably you meant:
where DATEDIFF(DAY, obj.datecreated, GETDATE()) = ' ... something?
--
David Portas
SQL Server MVP
--|||Well yes... I guess... but what do I need if I want all dates in that
table?|||Aenim wrote:
> Well yes... I guess... but what do I need if I want all dates in that
> table?
In that case remove the WHERE clause altogether.
--
David Portas
SQL Server MVP
--|||On 17 Nov 2005 15:26:17 -0800, "Aenim" <mackdaddiee@.hotmail.com>
wrote:
>Well yes... I guess... but what do I need if I want all dates in that
>table?
Omit the where clause!
J.