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

  • Home
  • SEARCH
  • 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 7972871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:57:58+00:00 2026-06-04T07:57:58+00:00

I am writing an SQL statement which needs to: Look for a job with

  • 0

I am writing an SQL statement which needs to:

  1. Look for a job with a certain number
  2. Match that job to another table
  3. Show the results

This is what I currently have.

select * from PreviousJobs pj, Jobs j where jobId = '273121' 
AND where (pj.sOtherRef = j.sOtherRef) = True    

Hmmmmm

  • 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-06-04T07:57:59+00:00Added an answer on June 4, 2026 at 7:57 am

    There’s no nesting needed; it is a simple JOIN that’s required, and that would be best written with the explicit join notation:

    SELECT cj.*, pj.* 
      FROM PreviousJobs AS pj
      JOIN Jobs         AS cj ON pj.sOtherRef = cj.sOtherRef
     WHERE cj.jobId = '273121' 
    

    You don’t need the second WHERE in your statement (that is a syntax error; you should have supplied us with the error message(s) that your DBMS gave you). You don’t need to compare the comparison with TRUE.

    The comma-separated list of table names in the FROM clause was necessary in SQL-86 and SQL-89, but has not been necessary since SQL-92 support was added into the DBMS. You should know about it so that if you get to read old SQL, you know what it means. But you should plan to use only the new JOIN notation unless there’s overwhelming (and ill-advised) pressure from workplace standards to use the old notation.

    Depending on the DBMS you use, you might find the AS in the table aliases is not permitted (Oracle), even though the standard says it is OK. That sort of difference is why it is a good idea to include information about your DBMS in the question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that needs to return search results from a SQL Server
Instead of deleting the child row and then writing another sql statement to delete
I am writing SQL Server deployment scripts which create SQL Server job automatically on
I am re-writing the SQL which lets a user search for any other user
I am writing an SQL query which involves finding if timestamp falls in particular
Possible Duplicate: Writing an SQL query to SELECT item from the following table I
I am writing a PL/SQL Procedure that performs a select based on input variables
So I'm tasked with writing a few SQL queries that involve finding the highest
I am writing a routine which works out the accruals of certain benefits to
Writing my first SQL query to run specifically as a SQL Job and I'm

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.