以日期为参考对列重新编号

时间:2018-08-04 20:51:10

标签: mysql sql

我有一个ind列,几乎具有随机值:
3 - 200 - 142 - ...

我需要这样更改:
1 - 2 - 3 - 4 - ...使用date(日期时间)列作为参考。

因此,最后,按date排序和按ind排序将给出相同的排序。

有帮助吗?

1 个答案:

答案 0 :(得分:1)

如果我理解正确,则可以执行以下操作:

 <?php
 /**
  * Buzz Store functions and definitions.
  *
  * @link https://developer.wordpress.org/themes/basics/theme-functions/
  *
  * @package Buzz_Store
  */

 if ( ! function_exists( 'buzzstore_setup' ) ) :
 /**
  * Sets up theme defaults and registers support for various WordPress 
 features.
  *
  * Note that this function is hooked into the after_setup_theme hook, which
  * runs before the init hook. The init hook is too late for some features, 
 such
  * as indicating support for post thumbnails.
  */
 function buzzstore_setup() {
    /*
     * Make theme available for translation.
      * Translations can be filed in the /languages/ directory.
      * If you're building a theme based on Buzz Store, use a find and replace
     * to change 'buzzstore' to the name of your theme in all the template files.
      */
     load_theme_textdomain( 'buzzstore', get_template_directory() . '/languages' );

    // Add default posts and comments RSS feed links to head.
    add_theme_support( 'automatic-feed-links' );

    // WooCommerce Plugins Support
    add_theme_support( 'woocommerce' );

    // Set up the WordPress Gallery Lightbox
    add_theme_support('wc-product-gallery-lightbox');

    /*
     * Let WordPress manage the document title.
     * By adding theme support, we declare that this theme does not use a
      * hard-coded <title> tag in the document head, and expect WordPress to
      * provide it for us.
     */
    add_theme_support( 'title-tag' );

    /*
     * Enable support for custom logo.
        */
    add_theme_support( 'custom-logo', array(
        'width'       => 190,
        'height'      => 60,
        'flex-width'  => true,              
        'flex-height' => true,
        'header-text' => array( '.site-title', '.site-description' ),
    ) );

    /*
     * Enable support for Post Thumbnails on posts and pages.
     *
     * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
    */
    add_theme_support( 'post-thumbnails' );
    add_image_size('buzzstore-banner-image', 1350, 485, true); // banner
    add_image_size('buzzstore-news-image', 370, 285, true); // Home Blog
    add_image_size('buzzstore-news-details-image', 850, 385, true); // Details Blog
    add_image_size('buzzstore-cat-image', 275, 370, true);


    // This theme uses wp_nav_menu() in one location.
    register_nav_menus( array(
        'topmenu' => esc_html__( 'Top Menu', 'buzzstore' ),
        'primary' => esc_html__( 'Primary', 'buzzstore' ),
    ) );

    /*
     * Switch default core markup for search form, comment form, and comments
     * to output valid HTML5.
     */
    add_theme_support( 'html5', array(
        'search-form',
        'comment-form',
        'comment-list',
        'gallery',
        'caption',
    ) );


function buzzstore_customize_partial_blogname() {
    bloginfo( 'name' );
}
function buzzstore_customize_partial_blogdescription() {
    bloginfo( 'description' );
}