Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Pervasive.SQL > Help with select query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-08, 12:53
RikoOnWeb RikoOnWeb is offline
Registered User
 
Join Date: Nov 2007
Posts: 3
Help with select query

Hi, I have a table that contains steps of a work order processing. Normally, each step should have it's closed flag set to Y as it gets finished. Sometimes this doesn't happen, so there are steps left open with lower sequence than steps that are already closed. I would need to select all these steps (incorrectly left opened).

For simplicity, the table JOB_OPERATIONS have columns JOB, SUFFIX, SEQ and FLAG_CLOSED. Every work order has it's unique job and suffix number combination. Each step has it's ascending sequence number in SEQ. Step can be either closed (Y in FLAG_CLOSED) or opened (FLAG_CLOSED empty).

All I could figure out is using two views and join them in a query but Pervasive 8.6 doesn't support grouped views (ODBC Error: SQLSTATE = S1000, Native error code = 0 Grouped view joins are not supported.) I am not sure if upgrade is an option.

Is there any other way how to get the records I need?

Thanks, I will appreciate any help.
Reply With Quote
  #2 (permalink)  
Old 03-10-08, 22:03
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 813
You might be able to issue the two queries joined without having the views. If that doesn't work, post the queries and we'll take a look at it to see if there's something we can suggest.
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
  #3 (permalink)  
Old 03-11-08, 10:08
RikoOnWeb RikoOnWeb is offline
Registered User
 
Join Date: Nov 2007
Posts: 3
Queries

To be honest, I am not sure how to join those queries in Pervasive 8.6. The queries are:

SELECT job, suffix, MIN(seq) as min_closed FROM job_operations WHERE flag_closed = 'Y' AND lmo = 'L' GROUP BY job, suffix

and

SELECT job, suffix, MIN(seq) as min_opened FROM job_operations WHERE flag_closed <> 'Y' and lmo = 'L' GROUP BY job, suffix

Essentially, I would need records where min_opened is less than min_closed.

Again, thank you for your help.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On