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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:45:15+00:00 2026-06-12T00:45:15+00:00

I have two table category and subcategory I am trying to delete record from

  • 0

I have two table category and subcategory
I am trying to delete record from this table using mysql query

Query is=

$sql="Delete t1, t2 From category as t1 
       INNER JOIN  subcategory as t2 on t1.c_id = t2.c_id
       WHERE t1.c_id='$del_c_id' ";

This query only delete row from category(t1) whose primary key used into subcategory(t2) table.

Not delete row from category(t1) whose primary key not used in subcategory(t2).

  • 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-12T00:45:16+00:00Added an answer on June 12, 2026 at 12:45 am

    You need to use a LEFT JOIN instead of INNER JOIN. By definition LEFT JOIN returns all results from t1, even if they don’t have a match in t2.

    See this link for more info on join types:
    http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html

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

Sidebar

Related Questions

Need some help with putting this query together. I'm using Mysql I have two
using mysql and php, I have two tables, I'm french so the table names
I have two tables: CATEGORY and SUBCATEGORY Table Structure for CATEGORY category_id int(11) category_name
My prob in brief: I have two tables namely category and product. table: category
Here is my scenario: I have two MySQL tables: Categories (columns: id, category) Items
Okay so I have two tables, a category table and a posts table. I
I have two tables, one with categories and subcategories. Each category and subcategory has
I have two columns in my Items table 'Category', 'Category2', the two columns contain,
I have two table each with Class Albums and Category as below : class
I have two tables, one is a table of names with a category tag

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.