Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Converting current date

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-02-21 : 13:23:51
In the code below entered_dt is int(4) and looks like 20110217

I want to grab the current date and convert it to the same format.

When I run the code below I get:
Incorrect syntax near the keyword 'group'.


SELECT distinct(dbo.oeordlin_sql.prod_cat), dbo.oeordhdr_sql.ord_no
FROM dbo.oeordhdr_sql INNER JOIN
dbo.oeordlin_sql ON dbo.oeordhdr_sql.ord_type = dbo.oeordlin_sql.ord_type AND dbo.oeordhdr_sql.ord_no = dbo.oeordlin_sql.ord_no
WHERE (dbo.oeordhdr_sql.entered_dt = (select convert(char(8), getdate(),112)) AND (dbo.oeordhdr_sql.ord_type = 'O')
group by dbo.oeordhdr_sql.ord_no, oeordlin_sql.prod_cat
ORDER BY dbo.oeordhdr_sql.ord_no, dbo.oeordlin_sql.prod_cat

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-21 : 13:27:30
You dont need to use Group By, as you have not used any group function in your Select Statement. Check it out by Commenting the Group by Clause

Cheers
MIK
Go to Top of Page
   

- Advertisement -