I'm working on a query and I need it to return 2 versions of the same column, so I'm trying to nest the 2nd version in to the first to return the results.
Here are my queries:
select modifications.timestamp, clients.name, remote_sites.name, modifications.name, oiversions.name
from remote_sites, modifications, clients, oiversions
where modifications.remote_site_id = remote_sites.id
and modifications.timestamp like '2007%' and remote_sites.client_id = 5
and clients.id = remote_sites.client_id and modifications.from_version = oiversions.id
order by modifications.timestamp, remote_sites.name asc
and
select oiversions.name
from remote_sites, modifications, clients, oiversions
where modifications.remote_site_id = remote_sites.id
and modifications.timestamp like '2007%' and remote_sites.client_id = 5
and clients.id = remote_sites.client_id and modifications.to_version = oiversions.id
the second of which returns a result i would like returned in the first.
So, I tried nesting the 2 queries like so:
select modifications.timestamp, clients.name, remote_sites.name, modifications.name, oiversions.name, (select oiversions.name
from remote_sites, modifications, clients, oiversions
where modifications.remote_site_id = remote_sites.id
and modifications.timestamp like '2007%' and remote_sites.client_id = 5
and clients.id = remote_sites.client_id and modifications.to_version = oiversions.id)
from remote_sites, modifications, clients, oiversions
where modifications.remote_site_id = remote_sites.id
and modifications.timestamp like '2007%' and remote_sites.client_id = 5
and clients.id = remote_sites.client_id and modifications.from_version = oiversions.id
order by modifications.timestamp, remote_sites.name asc
But I get the error "cannot retrieve resultset data"
Would anyone be able to tell me what I'm doing wrong? I've checked the syntax many times over and can't find a problem, unless my nesting isn't right. Thanks in advance.
Here are my queries:
select modifications.timestamp, clients.name, remote_sites.name, modifications.name, oiversions.name
from remote_sites, modifications, clients, oiversions
where modifications.remote_site_id = remote_sites.id
and modifications.timestamp like '2007%' and remote_sites.client_id = 5
and clients.id = remote_sites.client_id and modifications.from_version = oiversions.id
order by modifications.timestamp, remote_sites.name asc
and
select oiversions.name
from remote_sites, modifications, clients, oiversions
where modifications.remote_site_id = remote_sites.id
and modifications.timestamp like '2007%' and remote_sites.client_id = 5
and clients.id = remote_sites.client_id and modifications.to_version = oiversions.id
the second of which returns a result i would like returned in the first.
So, I tried nesting the 2 queries like so:
select modifications.timestamp, clients.name, remote_sites.name, modifications.name, oiversions.name, (select oiversions.name
from remote_sites, modifications, clients, oiversions
where modifications.remote_site_id = remote_sites.id
and modifications.timestamp like '2007%' and remote_sites.client_id = 5
and clients.id = remote_sites.client_id and modifications.to_version = oiversions.id)
from remote_sites, modifications, clients, oiversions
where modifications.remote_site_id = remote_sites.id
and modifications.timestamp like '2007%' and remote_sites.client_id = 5
and clients.id = remote_sites.client_id and modifications.from_version = oiversions.id
order by modifications.timestamp, remote_sites.name asc
But I get the error "cannot retrieve resultset data"
Would anyone be able to tell me what I'm doing wrong? I've checked the syntax many times over and can't find a problem, unless my nesting isn't right. Thanks in advance.