- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: dbaccess syntax
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-12-2008 12:57 PM
тАО02-12-2008 12:57 PM
select wf_model_id, wf_version, wf_key from wf_history where wf_model_id and
wf_version and wf_key in (
select wf_model_id, wf_version, wf_key
from wf_instance
where (wf_status <> 'I' and wf_status <> 'P') and (wf_start > DATE ('12/01/2006') and wf_start < DATE ('12/31/2006')) )
The error is: "A subquery has returned not exactly one column".
What am I doing wrong?
Monte
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2008 03:17 AM
тАО02-13-2008 03:17 AM
Solutioncertainly I have never seen this syntax before in 17 years of SQL, but i may be wrong.
Anyway I think you should re-write the query using a proper join and an alias; also remove the DATE functions because they totally destroy all chance of optimisation.
Something like this:
select h.wf_model_id, h.wf_version, h.wf_key
from wf_history h, wf_instance i
where (i.wf_status <>'I' and i.wf_status<>'P') and (i.wf_start>="12/01/2006") and (i.wf_start<="12/31/2006") and
h.model_id=i.wf_model_id and
h.wf_version=i.wf_version and
h.wf_key=i.wf_key
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2008 04:08 AM
тАО02-13-2008 04:08 AM
Re: dbaccess syntax
i.e. true if 1 and 1, false if either is zero, NULL and therefore undefined if a character.
Then it went into the subquery expecting a result just for wf_key, but you selected all 3 columns.
Try to use my query above, instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2008 07:27 AM
тАО02-13-2008 07:27 AM
Re: dbaccess syntax
Thank you for the syntax. Your way makes sense. The syntax I was using came from a knowledge base from a 3rd party.
When I use your syntax, I get an error:
Non-numeric character in datetime or
interval.
Monte
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2008 07:58 AM
тАО02-13-2008 07:58 AM
Re: dbaccess syntax
The field wf_start has a type of datetime year to second.
Monte