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 7830221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:08:00+00:00 2026-06-02T11:08:00+00:00

i have a problem with a query, for example with this one i can

  • 0

i have a problem with a query, for example with this one i can retrieve the records:

SELECT 
l.*, 
ll.f_cocacola as cocacola, 
 le.name AS deposit, 
 lp.price
FROM 
 KPC AS l, 
 KPC_cocacola AS ll, 
 KPC_deposit AS le, 
 KPC_price AS lp 
WHERE 
l.cod_deposit = le.id_deposit 
AND l.code = ll.code
AND lp.code = l.code
AND l.code_deposit = '002365' 

but now i need to include another date from another table -intranet- that has the fields code and url then need to show from this table the url field .. keep in mind that the relationship is on the code field.

so i change the query in this way:

SELECT l.*,ll.f_cocacola as cocacola, le.name AS deposit, 
lp.price, lintranet.url 
FROM tableX AS l, intranet_cocacola AS ll, tableX_deposit AS le, 
tableX_price AS lp, 
tableX_intranet as lintranet 
WHERE l.code_deposit = le.id_deposit
AND l.code = ll.code
AND lp.code = l.code 
AND l.code = lintranet.code
AND l.code_deposit = '456852147'

but the issue is that some records don’t have a url and if is not exist a url then this query don’t show me the record .. well what i need that even if there is not a url associated to a record i want to see that recorda, thanks

  • 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-02T11:08:02+00:00Added an answer on June 2, 2026 at 11:08 am

    Rewrite your query using ANSI join syntax and use LEFT JOIN:

    SELECT  l.*, ll.f_cocacola as cocacola, le.name AS deposit, 
            lp.price, lintranet.url 
    FROM    tableX AS l,
    JOIN    intranet_cocacola AS ll
    ON      ll.code = l.code
    JOIN    tableX_deposit AS le
    ON      le.id_deposit = l.code_deposit
    JOIN    tableX_price AS lp
    ON      lp.code = l.code
    LEFT JOIN
            tableX_intranet as lintranet
    ON      lintranet.code = l.code
    WHERE   l.code_deposit = '456852147'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with an SQL query on Postgresql. This select clause is
Hi there I have big problem with one select query There is a table:
I have a problem with the query below in postgres SELECT u.username,l.description,l.ip,SUBSTRING(l.createdate,0,11) as createdate,l.action
I have a problem with this query trying to get a sum and a
I have a problem with a query using hibernate. The entity class EntityClass has
i have a problem with sql query. I need to get list of users.
I have a problem with the following Linq query using Entity Framework: from o
I have a problem with a search query I am using my data contains
I have a little problem with a query. I'm selecting data using the between
I have a performance problem on a query. First table is a Customer table

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.