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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:01:26+00:00 2026-05-25T20:01:26+00:00

I have: a coupons table with a column called owner_id and id and an

  • 0

I have:

  • a coupons table with a column called owner_id and id
  • and an owners table with a column called id and website_url.

I’d like to get owners.website_url using only coupons.id (which is provided in a php variable $coupon_id.

Here’s my best shot:

SELECT owners.website_url
FROM owners o
LEFT JOIN coupons c
ON o.id = c.owner_id
WHERE c.id='$coupon_id'
LIMIT 1

Is this correct? I put LIMIT 1 beacause there are many coupons per owner.

  • 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-25T20:01:27+00:00Added an answer on May 25, 2026 at 8:01 pm

    It looks correct, but it’s pointless to use a LEFT JOIN there since you are filtering away the failed joins in your WHERE clause. Just use JOIN.

    You also shouldn’t need the LIMIT clause since all coupons should have unique ids (assuming that id is a primary key) and each coupon has only one owner.

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

Sidebar

Related Questions

I'm using CakePHP 2.0. I have 2 models/controllers (Category/Coupon): // File: Model/Coupon.php // Table
I have a table called tags , like this: +-------+----------+ | tagID | tagName
Hi I have a coupon system that uses one table (called coupons) to store
I have a link that calls: <a href=/coupons/print_coupon/<?php echo $coupon['id']; } ?> id=print><span style=margin-left:24px;>Print</span></a>
I have a system that allows users to enter coupons (for example like dell
I have column with the type ntext , and I would like to convert
I want to get only status = 1 records. But I don't have status
I have a query which involves 2 tables 'Coupons' and 'CouponUsedLog' in SQL Server,
I have a table called 'sample' with fields as 'sample_id, 'order_id', order_email_id', 'review_request', 'coupon_sent'.
I have json which I am trying to parse using Jackson. JSON looks as

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.