?
Solved

Need help with a simple SQL select statement

Posted on 2008-11-04
4
Medium Priority
?
169 Views
Last Modified: 2012-05-05
Hello,  I have a simple sql select statement.  It worked fine before I added the WHERE clause.  I need to only select records where the SlSaleKey and SlOrigSaleKey are not the same value.
SELECT Saleline.Slcustkey, CDate(DateValue(Saleline!SlWhen)) AS SlDate
WHERE Saleline.SlSaleKey <> SaleLine.SlOrigSaleKey
FROM Saleline
GROUP BY Saleline.Slcustkey, CDate(DateValue(Saleline!SlWhen));

Open in new window

0
Comment
Question by:Sean Rhudy
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 500 total points
ID: 22882787

 SELECT Saleline.Slcustkey, CDate(DateValue(Saleline!SlWhen)) AS SlDate
FROM Saleline
WHERE Saleline.SlSaleKey <> SaleLine.SlOrigSaleKey

GROUP BY Saleline.Slcustkey, CDate(DateValue(Saleline!SlWhen));
 
0
 
LVL 2

Expert Comment

by:kerwinsiy
ID: 22882789
is this linq?

SELECT Saleline.Slcustkey, CDate(DateValue(Saleline!SlWhen)) AS SlDate
FROM Saleline
WHERE Saleline.SlSaleKey <> SaleLine.SlOrigSaleKey
GROUP BY Saleline.Slcustkey, CDate(DateValue(Saleline!SlWhen));
0
 
LVL 2

Expert Comment

by:kerwinsiy
ID: 22882790
your where should be below the from ^^
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 22882794
SELECT Saleline.Slcustkey, CDate(DateValue(Saleline!SlWhen)) AS SlDate
FROM Saleline A,Saleline B
WHERE A.SlSaleKey <> B.SlOrigSaleKey

GROUP BY A.Slcustkey, CDate(DateValue(A!SlWhen));
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question