Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    375
    Plugin Contributions
    3

    red flag Save the Multi Table Query Result in phpmyadmin or by SQL CLI

    Hi all,

    I have a big problems of using phpmyadmin running this SQL.

    Code:
    SET @LAUNCH_DATE := '2012-01-01';
    SELECT * FROM address_book WHERE customers_id IN (select customers_info_id FROM customers_info WHERE customers_info_date_of_last_logon < @LAUNCH_DATE)
    ORDER BY `address_book`.`customers_id` DESC;
    It will show result no problems, but since it is not just query data from one table, it also using customers_info as source before query the address_book.

    My big problems is, while I am using phpmyadmin run above SQL, I can't full export above result to save as a SQL files for backup using.
    If the SQL query just only one table, then it can export all result to a SQL files no problems, just above SQL CLI can't save it result.



    Anyone there can tell me how do I can save above query result as SQL files for future using (For example, del above result, then restore it later by using this backup exported SQL files).

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Save the Multi Table Query Result in phpmyadmin or by SQL CLI

    Quote Originally Posted by explorer1979 View Post
    Hi all,

    I have a big problems of using phpmyadmin running this SQL.

    Code:
    SET @LAUNCH_DATE := '2012-01-01';
    SELECT * FROM address_book WHERE customers_id IN (select customers_info_id FROM customers_info WHERE customers_info_date_of_last_logon < @LAUNCH_DATE)
    ORDER BY `address_book`.`customers_id` DESC;
    It will show result no problems, but since it is not just query data from one table, it also using customers_info as source before query the address_book.

    My big problems is, while I am using phpmyadmin run above SQL, I can't full export above result to save as a SQL files for backup using.
    If the SQL query just only one table, then it can export all result to a SQL files no problems, just above SQL CLI can't save it result.



    Anyone there can tell me how do I can save above query result as SQL files for future using (For example, del above result, then restore it later by using this backup exported SQL files).
    I haven't considered everything involved, but what it sounds like you want to do is create a table, and then insert into that table the results of the query. Besides that, I'm not sure what the issue is with the query, because in php you set a variable/array that equals the result.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Save the Multi Table Query Result in phpmyadmin or by SQL CLI

    You could try something like this:

    Code:
    SET @LAUNCH_DATE := '2012-01-01';
    CREATE TABLE customers2012 ENGINE=MyISAM 
    AS
    SELECT * FROM address_book WHERE customers_id IN (select customers_info_id FROM customers_info WHERE customers_info_date_of_last_logon < @LAUNCH_DATE)
    ORDER BY `address_book`.`customers_id` DESC;
    NOTE: you may or may not need the:
    ENGINE=MyISAM

    depending on your current tables ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. Mysql multi-table query construction
    By gjh42 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 26 Jun 2014, 03:21 PM
  2. Replies: 2
    Last Post: 15 Aug 2011, 04:58 AM
  3. phpmyadmin sql to copy table fields?
    By tvsupport in forum General Questions
    Replies: 4
    Last Post: 19 Apr 2011, 09:31 AM
  4. Need help w/ SQL query in phpMyAdmin
    By audradh in forum General Questions
    Replies: 17
    Last Post: 16 Nov 2009, 01:05 PM
  5. Specifying 'Product priced by attributes' by running phpmyadmin SQL query?
    By vandiermen in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 2 Aug 2009, 06:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg