Skip to main content
GameDev.net gamedev.net
🔒 Locked

SQL Headaches

Started by ChaosEngine May 13, 2004 at 1:46 AM 0 replies 450+ views
Original Post
ChaosEngine
ChaosEngine
ok how the hell do I do this? I have a an SQL query that returns a list of records in use
result set:

records
======
  A
  B
  F
  G
  
and another query that returns a list of all records
result set:

records
======
  A
  B
  C
  D
  E
  F
  G
  
what I want is some kind of compund query that will return all records in one column and some kind of indicator if they're in use in another ala
records | InUse
===============
  A     |   1
  B     |   1
  C     |   0
  D     |   0
  E     |   0
  F     |   1
  G     |   1
  
I've been tearing my hair out trying to figure this out... any thoughts? DB is oracle.... [edit] nevermind, got it[/edit] [edited by - ChaosEngine on May 13, 2004 3:12:55 AM]
if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight
Charon
Charon

select t1.record "Records", count( t2.record ) "InUse"
from table1 t1, table2 t2
where t1.record = t2.record(+)
group by t1.record


chaos, panic and disorder - my work here is finished

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.