Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6913685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:14:58+00:00 2026-05-27T09:14:58+00:00

I’ve got a PostgreSQL-9.0.x database that manages an automated testing environment. There are a

  • 0

I’ve got a PostgreSQL-9.0.x database that manages an automated testing environment. There are a bunch of tables that contain assorted static data (OS versions, test names, etc) named ‘buildlist’ & ‘osversmap’. However, there are also two tables which contain data which changes often. The first is a ‘pending’ table which is effectively a test queue where pending tests are self-selected by the test systems, and then deleted when the test run has completed. The second is a ‘results’ table which contains the test results as they are produced (in progress and completed).

The records in the pending table have a one to many relationship with the records in the results table (each row in pending can have 0 or more rows in results). For example, if no test systems have self-assigned a pending row, then there will be zero associated rows in results, and then once a pending row is assigned, the number of rows in results will increase for each pending row. An added catch is that I always want only the newest results table row associated with each pending table row. What I need to do is query the ‘pending’ table for pending tests, and then also get a ‘logurl’ from the results table that corresponds to each pending table row.

All of this is rather similar to this problem, except that I have the added burden of the two additional tables with the static data (buildlist & osversmap):
PHP/SQL: Using only one query, SELECT rows from two tables if data is in both tables, or just SELECT from one table if not

I’m stumbling over how to integrate those two tables with static data into the query. The following query works fine as long as there’s at least one row in the ‘results’ table that corresponds to each row in the pending table (however, it doesn’t return anything for rows that only exist in ‘pending’ yet not yet in ‘results’):

SELECT 
 pending.cl,
 pending.id,
 pending.buildid,
 pending.build_type,
 pending.active,
 pending.submittracker,
 pending.os,pending.arch,
 pending.osversion,
 pending.branch,
 pending.comment,
 osversmap.osname,
 buildlist.buildname,
 results.logurl 
FROM pending ,osversmap ,buildlist ,results 
WHERE 
 pending.buildid=buildlist.id 
 AND pending.os=osversmap.os 
 AND pending.osversion=osversmap.osversion 
 AND pending.owner='$owner' 
 AND pending.completed='f' 
 AND results.hostname=pending.active 
 AND results.submittracker=pending.submittracker 
 AND pending.cl=results.cl 
 AND results.current_status!='PASSED' 
 AND results.current_status NOT LIKE '%FAILED' 
ORDER BY pending.submittracker,pending.branch,pending.os,pending.arch

thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:14:59+00:00Added an answer on May 27, 2026 at 9:14 am

    Does the following work for you?

    SELECT  pending.cl,
            pending.id,
            pending.buildid,
            pending.build_type,
            pending.active,
            pending.submittracker,
            pending.os,
            pending.arch,
            pending.osversion,
            pending.branch,
            pending.comment,
            osversmap.osname,
            buildlist.buildname,
            results.logurl
    FROM pending
        JOIN osversmap
            ON ( pending.os = osversmap.os
                AND pending.osversion = osversmap.osversion )
        JOIN buildlist
            ON ( pending.buildid = buildlist.id )
        LEFT OUTER JOIN results
            ON ( pending.active = results.hostname
                AND pending.submittracker = results.submittracker
                AND pending.cl = results.cl 
                AND results.current_status != 'PASSED'
                AND results.current_status NOT LIKE '%FAILED'
                )
    WHERE pending.owner = '$owner'
        AND pending.completed = 'f'
    ORDER BY pending.submittracker,
        pending.branch,
        pending.os,
        pending.arch
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
i got an object with contents of html markup in it, for example: string
I need a function that will clean a strings' special characters. I do NOT
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.