Bonegavel
05-25-2006, 08:45 AM
Table: order
fields: vendor, orderstatus, location
I want to select only records where:
orderstatus = 2 and the vendor and locations are identical.
example table (obviously not my actual table)
# | vendor | location | orderstatus
------------------------------------
1 | ABC | townA | 2
2 | 123 | townB | 2
3 | ABC | townA | 1
4 | ABC | townA | 2
5 | 123 | townB | 2
the query i'm trying to build will only return 1,2,4,5 (with the pairs being 1 and 4 and 2 and 5).
I'm guessing I need to do a join of some sort and would appreciate any help even if that help is a site.
I'm using MS Sql server 2000 (which is tSql just for clarification).
fields: vendor, orderstatus, location
I want to select only records where:
orderstatus = 2 and the vendor and locations are identical.
example table (obviously not my actual table)
# | vendor | location | orderstatus
------------------------------------
1 | ABC | townA | 2
2 | 123 | townB | 2
3 | ABC | townA | 1
4 | ABC | townA | 2
5 | 123 | townB | 2
the query i'm trying to build will only return 1,2,4,5 (with the pairs being 1 and 4 and 2 and 5).
I'm guessing I need to do a join of some sort and would appreciate any help even if that help is a site.
I'm using MS Sql server 2000 (which is tSql just for clarification).