Hello There, Guest!
View New Posts  |  View Today's Posts
SQL QUERY?

  • 0 Vote(s) - 0 Average


02-20-2015, 11:53 AM #1
william7
Member
**
Posts: 205 Threads:49 Joined: Feb 2012 Reputation: 0

SQL QUERY?
I know there must be a simple explanation as to why this doesn't work for me. I need to list the order number, part description, and item class for each pair of parts that are in the same item class. (For example, one such pair would be part AT94 and part FD21, because the item class for both parts is HW.). All I get is the column headings without the data as shown below.




02-21-2015, 09:15 PM #2
Null
Moderator
*****
Moderators
Posts: 130 Threads:23 Joined: Feb 2012 Reputation: 4

RE: SQL QUERY?
I don't understand your question. In scenarios like this, it's helpful to show what you expect the result to look like.

Although I do not understand your problem very well, it is clear to me why your query is producing an empty set. Ask yourself: how can a "class" be equal to "HW" and "SG"? It makes no sense.
This post was last modified: 02-21-2015, 09:18 PM by Null.

02-21-2015, 09:22 PM #3
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: SQL QUERY?
ByteBlast is correct, you probably want 'OR' instead of 'AND'


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

02-22-2015, 10:05 AM #4
william7
Member
**
Posts: 205 Threads:49 Joined: Feb 2012 Reputation: 0

RE: SQL QUERY?
It worked nicely Ace! Thanks!


02-24-2015, 03:15 AM #5
Lee Stevens
Senior Member
***
Posts: 345 Threads:54 Joined: Feb 2012 Reputation: 12

RE: SQL QUERY?
If you want to be different you can use IN also :P

02-24-2015, 08:26 AM #6
william7
Member
**
Posts: 205 Threads:49 Joined: Feb 2012 Reputation: 0

RE: SQL QUERY?
Lee, how would I use the IN Operator in the one below? I've made several different tries and none work. I want to find the number and name of each customer that placed an order on October 23, 2010.




02-24-2015, 03:53 PM #7
Lee Stevens
Senior Member
***
Posts: 345 Threads:54 Joined: Feb 2012 Reputation: 12

RE: SQL QUERY?
For this instance you wouldn't use IN, you can't just pick and choose, you use what suits your needs and query.

For this is a simple select where date = date




Forum Jump:



Users browsing this thread: 1 Guest(s)