Click here to Skip to main content
15,880,200 members
Home / Discussions / Database
   

Database

 
GeneralRe: Is Oracle really so much faster than MS Sql Pin
Mike Dimmick11-Nov-03 23:49
Mike Dimmick11-Nov-03 23:49 
GeneralRe: Is Oracle really so much faster than MS Sql Pin
CillyMe12-Nov-03 3:09
CillyMe12-Nov-03 3:09 
GeneralRe: Is Oracle really so much faster than MS Sql Pin
Bill Priess12-Nov-03 8:36
Bill Priess12-Nov-03 8:36 
GeneralRe: Is Oracle really so much faster than MS Sql Pin
Matt Gullett12-Nov-03 17:15
Matt Gullett12-Nov-03 17:15 
GeneralSql help Pin
pankajdaga11-Nov-03 11:57
pankajdaga11-Nov-03 11:57 
GeneralRe: Sql help Pin
Edbert P11-Nov-03 18:23
Edbert P11-Nov-03 18:23 
GeneralRe: Sql help Pin
pankajdaga11-Nov-03 20:35
pankajdaga11-Nov-03 20:35 
GeneralRe: Sql help Pin
jeff_martin12-Nov-03 7:44
jeff_martin12-Nov-03 7:44 
You can join your table to itself to do this. (I think this is what you are asking for...


select t1.testnum, count(t1.testnum)
from test t1
join test t2 on (t1.testnum = t2.testnum)
where t1.state = 2 and t1.value = 1
and t2.state = 2 and t2.value = 0
group by t1.testnum

this selects the testnum and a count from the table, joins itself based on the testnum and the where clause specifies where your first criteria matches on the "first" table and the second criteria matches on the "second" (your self join) table. Group it by testnum to see the count for each testnum that matches. Here are the results of that query...

Testnum count
100 1

If you change the t2.state = 2 to t2.state = 1, you get back
100 1
101 1

If this isn't what you are after, enlighten me some more on what you want.

GeneralRe: Sql help Pin
pankajdaga12-Nov-03 21:42
pankajdaga12-Nov-03 21:42 
GeneralRe: Sql help Pin
jeff_martin13-Nov-03 3:36
jeff_martin13-Nov-03 3:36 
GeneralRe: Sql help Pin
pankajdaga13-Nov-03 10:15
pankajdaga13-Nov-03 10:15 
Generalaccess permissions Pin
ranjjj11-Nov-03 3:57
ranjjj11-Nov-03 3:57 
GeneralRe: access permissions Pin
ranjjj11-Nov-03 4:04
ranjjj11-Nov-03 4:04 
GeneralRe: access permissions Pin
Jeff Varszegi11-Nov-03 4:41
professionalJeff Varszegi11-Nov-03 4:41 
Generalextended procedure for sql server Pin
mhmoud rawas11-Nov-03 1:21
mhmoud rawas11-Nov-03 1:21 
GeneralRe: extended procedure for sql server Pin
Mike Dimmick11-Nov-03 10:08
Mike Dimmick11-Nov-03 10:08 
GeneralRe: extended procedure for sql server Pin
mhmoud rawas11-Nov-03 18:21
mhmoud rawas11-Nov-03 18:21 
GeneralRe: extended procedure for sql server Pin
Mike Dimmick11-Nov-03 23:02
Mike Dimmick11-Nov-03 23:02 
GeneralRe: extended procedure for sql server Pin
mhmoud rawas11-Nov-03 23:16
mhmoud rawas11-Nov-03 23:16 
GeneralMore DTS questions Pin
Megan Forbes10-Nov-03 23:49
Megan Forbes10-Nov-03 23:49 
QuestionDataGrid - stopping additions, while allowing edits: possible? Pin
Pauwll10-Nov-03 23:46
Pauwll10-Nov-03 23:46 
AnswerRe: DataGrid - stopping additions, while allowing edits: possible? Pin
Mike Dimmick11-Nov-03 10:13
Mike Dimmick11-Nov-03 10:13 
GeneralRe: DataGrid - stopping additions, while allowing edits: possible? Pin
Pauwll11-Nov-03 17:56
Pauwll11-Nov-03 17:56 
GeneralMigrate SQL to Oracle Pin
TPN10-Nov-03 16:40
TPN10-Nov-03 16:40 
GeneralRe: Migrate SQL to Oracle Pin
Guillermo Rivero12-Nov-03 7:31
Guillermo Rivero12-Nov-03 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.