-
Query help
ok I am through pulling my hair out and decided to let you guys help me .
I have 2 tables
Table 1
ID - Container - internalid
100 A01001 1
101 A01002 3
102 A01003 2
103 A01001 4
104 A01003 5
Table 2
ID Container ShortName
1 A01001 A01
2 A01002 A01
3 A01003 A01
My problem is this
1 - I start with the internal id of 1
2 - I need ot find the only container in table 1 with 1 record
Expected output = 102
My attempts have been
select
id, container
from
table 1
where
substr(container,1,9) in
(
select substr(container,1,9)
from table 1
where ID in (1)
) and
having count(container) = 1
group by id, container -- I really don't want to group here, but have to and this screws up the query
order by container
Thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|