Stumped again: How do I create a query that selects all itemNO where the cost changed, then changed back? In this example I would want >all< records where itemNO equals 3 but not 4 sigh create table test1 ( idno int NOT NULL IDENTITY (1, 1), itemNo int, cost money, thisdate datetime) insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/13/03') insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/13/03') insert into test1 (itemNo, cost, thisdate) values(3, 56,'3/16/03') insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/17/03') insert into test1 (itemNo, cost, thisdate) values(3, 58,'3/17/03') insert into test1 (itemNo, cost, thisdate) values(4, 76,'3/17/03') insert into test1 (itemNo, cost, thisdate) values(4, 76,'3/20/03') insert into test1 (itemNo, cost, thisdate) values(4, 77,'3/21/03') select * from test1 drop table test1 I really appreciate it
I might be missing the point too, but why would you think that??? 4??? How do I create a query that selects all itemNO where the cost changed, then changed back? The only records that satisfy this query are records with itemNO =3 (with the data that I provided) But what would the query be? [quoted text, click to view] "Jack Vamvas" <info@nospam.com> wrote in message news:bj96p3$pne$1@titan.btinternet.com... > > "Bite My Bubbles" <bmb@mybubbles.com> wrote in message > news:#wIbhp2cDHA.1280@tk2msftngp13.phx.gbl... > > Stumped again: > > > > How do I create a query that selects all itemNO where the cost changed, > then > > changed back? > > > > In this example I would want >all< records where itemNO equals 3 but not > 4 > > > > sigh > > > > create table test1 ( idno int NOT NULL IDENTITY (1, 1), > > itemNo int, > > cost money, > > thisdate datetime) > > > > insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/13/03') > > insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/13/03') > > insert into test1 (itemNo, cost, thisdate) values(3, 56,'3/16/03') > > insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/17/03') > > insert into test1 (itemNo, cost, thisdate) values(3, 58,'3/17/03') > > > > insert into test1 (itemNo, cost, thisdate) values(4, 76,'3/17/03') > > insert into test1 (itemNo, cost, thisdate) values(4, 76,'3/20/03') > > insert into test1 (itemNo, cost, thisdate) values(4, 77,'3/21/03') > > select * from test1 > > drop table test1 > > > > > > > > I really appreciate it > > > > > I might be missing the point but do you mean , select * from test1 where > itemNo = 4 ? > > JV > -- > ___________________________________________________________________ > Remotely manage MS SQL db with SQLdirector - > www.ciquery.com/tools/sqldirector/ > >
[quoted text, click to view] "Bite My Bubbles" <bmb@mybubbles.com> wrote in message news:#wIbhp2cDHA.1280@tk2msftngp13.phx.gbl... > Stumped again: > > How do I create a query that selects all itemNO where the cost changed, then > changed back? > > In this example I would want >all< records where itemNO equals 3 but not 4 > > sigh > > create table test1 ( idno int NOT NULL IDENTITY (1, 1), > itemNo int, > cost money, > thisdate datetime) > > insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/13/03') > insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/13/03') > insert into test1 (itemNo, cost, thisdate) values(3, 56,'3/16/03') > insert into test1 (itemNo, cost, thisdate) values(3, 55,'3/17/03') > insert into test1 (itemNo, cost, thisdate) values(3, 58,'3/17/03') > > insert into test1 (itemNo, cost, thisdate) values(4, 76,'3/17/03') > insert into test1 (itemNo, cost, thisdate) values(4, 76,'3/20/03') > insert into test1 (itemNo, cost, thisdate) values(4, 77,'3/21/03') > select * from test1 > drop table test1 > > > > I really appreciate it > >
I might be missing the point but do you mean , select * from test1 where itemNo = 4 ? JV -- ___________________________________________________________________ Remotely manage MS SQL db with SQLdirector - www.ciquery.com/tools/sqldirector/
Don't see what you're looking for? Try a search.
|