May 7, 2015 at 7:48 am
Hi Guys,
I am kind of struggling to get the result for current date orders but I can get the query working for due date.
"
SalesOrder.DateEntered,
SalesLine.OrderQuantity, (SalesLine.OrderQuantity*SalesLine.SellingPrice / SalesOrder.ExchangeRate) AS Value,
(SalesLine.SellingPrice / SalesOrder.ExchangeRate) AS Price
FROM Company INNER JOIN
CustomerAccount ON Company.CompanyID = CustomerAccount.CompanyID INNER JOIN
SalesOrder ON CustomerAccount.CustomerAccountID = SalesOrder.CustomerAccountID INNER JOIN
SalesLine ON SalesOrder.SalesOrderID = SalesLine.SalesOrderID
WHERE (SalesOrder.DateEntered = { fn CURDATE() })
"
Can please someone tell me where am I going wrong?
May 7, 2015 at 8:12 am
yusufm 48726 (5/7/2015)
Hi Guys,I am kind of struggling to get the result for current date orders but I can get the query working for due date.
"
SalesOrder.DateEntered,
SalesLine.OrderQuantity, (SalesLine.OrderQuantity*SalesLine.SellingPrice / SalesOrder.ExchangeRate) AS Value,
(SalesLine.SellingPrice / SalesOrder.ExchangeRate) AS Price
FROM Company INNER JOIN
CustomerAccount ON Company.CompanyID = CustomerAccount.CompanyID INNER JOIN
SalesOrder ON CustomerAccount.CustomerAccountID = SalesOrder.CustomerAccountID INNER JOIN
SalesLine ON SalesOrder.SalesOrderID = SalesLine.SalesOrderID
WHERE (SalesOrder.DateEntered = { fn CURDATE() })
"
Can please someone tell me where am I going wrong?
CURDATE is a mysql function. This is a sql server forum. You are likely going to get better assistance from a mysql forum.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
May 7, 2015 at 8:19 am
Sean Lange (5/7/2015)
CURDATE is a mysql function. This is a sql server forum. You are likely going to get better assistance from a mysql forum.
Nice catch, Sean. I wouldn't have known what CURDATE was, but the syntax of it in the query would have thrown me into research mode. 😉
May 7, 2015 at 8:20 am
Cheers guys, I would ask in mysql forum. or is there a sql function where I could get current date orders?
May 7, 2015 at 8:28 am
yusufm 48726 (5/7/2015)
Cheers guys, I would ask in mysql forum. or is there a sql function where I could get current date orders?
Well are you using sql server or mysql? Providing an answer for sql server is not going to help if you are using mysql. Here is a list of sql server datetime functions. https://msdn.microsoft.com/en-us/library/ms186724.aspx
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
May 7, 2015 at 8:33 am
I am using Microsoft SQL Server 2008.
May 7, 2015 at 8:38 am
http://www.sqlservercentral.com/Forums/Topic1318719-1291-1.aspx
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
May 7, 2015 at 8:42 am
J Livingston SQL (5/7/2015)
http://www.sqlservercentral.com/Forums/Topic1318719-1291-1.aspx
heh seems that we have covered this before. Well done.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply