Mysql Error Number 1096
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the error 1096 mysql workings and policies of this site About Us Learn more about no tables used codeigniter Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions codeigniter error number 1096 Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. codeigniter custom query Join them; it only takes a minute: Sign up MYSQL ERROR 1096 - NO TABLES USED - CODEIGNITER up vote 1 down vote favorite I am using a custom query as the Active Record equivelant did not work for me. When placing the Query in my Database Software SQLYOG it works fine however in CodeIgniter it says A Database Error Occurred Error Number: 1096 No tables used SELECT * Filename: C:\xampp\htdocs\midas\system\database\DB_driver.php Line Number: 330 Here is my Query: SELECT intervention.department_id, department_name, COUNT(*) FROM intervention LEFT JOIN department ON department.department_id = intervention.department_id GROUP BY intervention.department_id, department.department_name ORDER BY COUNT(*) desc LIMIT 1 It is a bit of a strange problem. Here is my Schema also: http://i.imgur.com/mKNtc.png php mysql database codeigniter share|improve this question asked Aug 3 '11 at 14:17 sqlmole 41241328 I don't think it's the posted query thats causing the error. –Jacob Aug 3 '11 at 14:20 Can you show the code that you build the query? –Alfonso Rubalcava Aug 3 '11 at 14:58 add a comment| 3 Answers 3 active oldest votes up vote 1 down vote accepted EDIT This will not work. As noted below only COUNT(*) or COUNT(table.field) work. I think you need to specify which table you are using COUNT(*) on, so change it to something like COUNT(department.*) or COUNT(intervention.*) share|improve this answer edited Aug 3 '11 at 14:38 answered Aug 3 '11 at
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack http://stackoverflow.com/questions/6927940/mysql-error-1096-no-tables-used-codeigniter Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CodeIgniter MySQL query not working up vote 4 down vote favorite 1 I'm trying to get this query to work in CodeIgniter but it's spitting http://stackoverflow.com/questions/4839038/codeigniter-mysql-query-not-working out an error: A Database Error Occurred Error Number: 1096 No tables used SELECT * If I put the query directly into MySQL it works fine (I replace the $variables with values). Here is the query as input into codeigniter: $this->db->query(" SELECT * FROM writing_quests LEFT OUTER JOIN members_quests_completed ON members_quests_completed.quest_id = writing_quests.id WHERE writing_quests.level_required <= $userlevel AND ( members_quests_completed.user_id = $user_id OR members_quests_completed.user_id IS NULL )" ); $query = $this->db->get(); Am I doing something that is wrong and I am missing it? I've included the while function call in case the problem is somewhere else? I've done this exact thing many times without an issue. function get_all_quests_for_user() { $user_id = $this->session->userdata('user_id'); $userlevel = $this->session->userdata('user_level'); $this->db->query("SELECT writing_quests.id, writing_quests.points_availible, writing_quests.name, writing_quests.note, writing_quests.instructions, writing_quests.time_limit, members_quests_completed.location_completed, members_quests_completed.status FROM writing_quests LEFT OUTER JOIN members_quests_completed ON members_quests_completed.quest_id = writing_quests.id WHERE writing_quests.level_required <= '$userlevel' AND writing_quests.unlocked = 1 AND ( members_quests_completed.user_id = '$user_id' OR members_q
forgot password? This is an archived forum and may no longer be relevant. The active forums are here. Advanced https://ellislab.com/forums/archive/viewthread/220524 Search Error 1096 - No tables Used Scott Jones Posted: 09 July 2012 07:41 AM Joined: 2012-07-092 posts Hi All, Im getting the http://dev.mysql.com/doc/en/error-messages-server.html above MYSQL error when trying to use active records within an EE 2.x module and i can understand why, my code is as follows: error number //build select statement $this->EE->db->select("DISTINCT t.tour_internal_id AS Tour_ID, t.tour_depart AS tour_Depart, i.itinerary_internal_id Itinerary_ID, i.itinerary_depart Depart_UK, i3.itinerary_arrive Arrive_UK, t.tour_headline_price Price, s.supplier_name Supplier_Name, t.tour_status AS Tour_Status, t.tour_master_code as Tour_Master_Code, i.itinerary_restricted AS Restricted", FALSE); //build from and join clauses $this->EE->db->from("tour AS t"); $this->EE->db->join("itinerary AS i", "i.itinerary_tour_id = t.tour_internal_id AND i.itinerary_out = error number 1096 1 AND i.hguid = '{$this->hguid}' AND i.itinerary_type in ('Flight', 'Eurostar', 'Rail') AND i.itinerary_name = '{$depPoint}' AND i.itinerary_availability >= {$numPax} AND i.itinerary_cid = {$company}"); $this->EE->db->join("itinerary AS i2", "i2.itinerary_tour_id = t.tour_internal_id AND i2.hguid = '{$this->hguid}' AND i2.itinerary_type ='Accomodation' AND i2.itinerary_availability >= {$numPax} AND i2.itinerary_max_occupance <= {$numPax} AND i2.itinerary_cid = {$company}"); $this->EE->db->join("supplier AS s", "s.supplier_internal_id = i2.itinerary_supplier_id AND s.hguid = '{$this->hguid}' {$riverCruise}"); $this->EE->db->join("itinerary AS i3", "i3.itinerary_link_id = i.itinerary_internal_id AND i3.itinerary_out <> 1 and i3.hguid = '{$this->hguid}' AND i3.itinerary_type in ('Flight', 'Eurostar') AND i3.itinerary_cid = {$company}", "Left"); //build where statement $this->EE->db->where("t.tour_master_code", $tourCode); $this->EE->db->where("t.hguid", $this->hguid); $this->EE->db->where("t.tour_cid", $company); //build order by clause $this->EE->db->order_by("t.tour_depart", "ASC"); $this->EE->db->order_by("i.itinerary_depart", "ASC"); $this->EE->db->order_by("i3.itinerary_arrive", "DESC"); $this->EE->db->order_by("s.supplier_name", "ASC"); //set distinct //$this->EE->db->distinct(); //get results $query = $this->EE->db->get(); the error is: Error Number: 1096 No tables used SELECT * Filename: C:\Users\Scott.Jones\Google Drive\workspace\riv-web-new\system\codeigniter\system\database\DB_driver.php Line Number: 330 I have looked around and from what i can see its usua
Connectors More MySQL.com Downloads Developer Zone Section Menu: Documentation Home MySQL 5.7 Reference Manual Preface and Legal Notices General Information Installing and Upgrading MySQL Using MySQL as a Document Store Tutorial MySQL Programs MySQL Server Administration Security Backup and Recovery Optimization Language Structure Globalization Data Types Functions and Operators SQL Statement Syntax The InnoDB Storage Engine Alternative Storage Engines High Availability and Scalability Replication MySQL Cluster NDB 7.5 Partitioning Stored Programs and Views INFORMATION_SCHEMA Tables MySQL Performance Schema MySQL sys Schema Connectors and APIs Extending MySQL MySQL Enterprise Edition MySQL Workbench MySQL 5.7 Frequently Asked Questions Errors, Error Codes, and Common Problems Sources of Error Information Types of Error Values Server Error Codes and Messages Client Error Codes and Messages Problems and Common Errors How to Determine What Is Causing a Problem Common Errors When Using MySQL Programs Access denied Can't connect to [local] MySQL server Lost connection to MySQL server Client does not support authentication protocol Password Fails When Entered Interactively Host 'host_name' is blocked Too many connections Out of memory MySQL server has gone away Packet Too Large Communication Errors and Aborted Connections The table is full Can't create/write to file Commands out of sync Ignoring user Table 'tbl_name' doesn't exist Can't initialize character set File Not Found and Similar Errors Table-Corruption Issues Administration-Related Issues Problems with File Permissions How to Reset the Root Password What to Do If MySQL Keeps Crashing How MySQL Handles a Full Disk Where MySQL Stores Temporary Files How to Protect or Change the MySQL Unix Socket File Time Zone Problems Query-Related Issues Case Sensitivity in String Searches Problems Using DATE Columns Problems with NULL Values Problems with Column Aliases Rollback Failure for Nontransactional Tables Deleting Rows from Related Tables Solving Problems with No Matching Rows Problems with Floating-Point Values Optimizer-Related Issues Table Definition-Related Issues Problems with ALTER TABLE TEMPORARY Table Problems Known Issues in MySQL Restrictions and Limits Indexes MySQL Glossary Related Documentation MySQL 5.7 Release Notes Download this Manual PDF (US Ltr) -