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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:22:11+00:00 2026-05-27T01:22:11+00:00

I have a bit of a situation here. I have a query: SELECT DISTINCT

  • 0

I have a bit of a situation here.

I have a query:

SELECT DISTINCT (testrecurring.id), testrecurring.cxl, testci.cd
FROM testci, testrecurring 
WHERE (testci.id = testrecurring.id) 
AND testci.x_origin='1' 
ORDER BY testrecurring.id DESC;

Now, if a var is not set, I need to do a select on this query, and here is the catch. I need to exclude some id’s. Here is how I’m doing it now.

I create a table with that query: create table xxx SELECT * ..... and now the results from my previous query are inside another table called xxx.

Then:

if (!isset($var)) {
    $delete = mysql_query("delete from xxx USING xxx, future_recurring where xxx.id = future_recurring.id");
}

and after the records have been deleted I do my final select * from xxx.

This works just fine, the only thing is that I need to redo all this logic by not creating any tables. Maybe doing some joins, I’m not sure how to proceed.

I hope this is not very confusing.

Any ideas?

  • 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-27T01:22:12+00:00Added an answer on May 27, 2026 at 1:22 am

    And now how about this?:

    SELECT tr.id, tr.cxl, tci.cd
    FROM testci AS tci 
    INNER JOIN testrecurring AS tr
        ON tci.id = tr.id
    LEFT OUTER JOIN future_recurring AS fr
        ON tr.id = fr.id
    WHERE tci.x_origin='1' 
        AND fr.id IS NULL
    GROUP BY tr.id, tr.cxl, tci.cd
    ORDER BY tr.id DESC
    

    This only includes results in which the testrecurring.id is NOT FOUND in future_recurring

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

Sidebar

Related Questions

This is a bit of an odd situation. Here's what's happening. So, we have
I'm having a bit of a weird situation here. I have a form that
Here's the situation: I have a bit of graphical content inside a symbol that
Here's the situation - its a bit different from the other database/password questions on
I have a bit of a situation. I've consumed about fourty-eleven different tutorials/books/videos on
I have the following situation in code, which I suspect may be a bit
The situation is a bit hard to explain, I'll do my best. I have
I'm in a bit of a doubt about this subject. Situation: I have conducted
I have a bit of a pickle here and wonder if anyone can give
I have a bit of an architecture problem here. Say I have two tables,

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.