mysql,php,column to generat增加intiger,但每年从一个开始 [英] mysql, php , column to generat incremented intiger , but start from one each year

查看:103
本文介绍了mysql,php,column to generat增加intiger,但每年从一个开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

**我正在使用mysql和php **



表格:



ID:auto公司

NO:int

名称:varchare

日期:date



现在我的ID是自动递增的,从1开始递增到....



这里的想法是我需要的列(** NO **)将它设置为从1生成并递增

向前但是每年的每个开始日我希望它从1开始。


$ b $例如:2013年



id无名称日期

1 10 ab 2014-01-01

2 11 cd 2014-01-02

3 12 ef 2014-01-03



当年度变化时(2015-01-01 )取决于应用程序级别的系统时间和日期,或者数据库级别应该理解的从一个开始它



4 1 gh 2015- 01-01

5 2 ig 2015-02-01

现在更改为2016-01-01



6 1 mk 2016-02-01



所以我应该将列NO设置为工作,这样用户干涉它应该通过

应用程序(PHP)或数据库(mysql) )



*** 1-我需要在应用程序(php)上编码吗? ---任何教程链接

2-数据库(mysql)可以理解并做到这一点吗?***





提前问候

**i am using mysql and php**

table :

ID: auto inc
NO: int
name: varchare
date: date

Now here my ID is auto incremented which is starting from 1 and increments to ....

here the idea is the column (**NO**) i need to set it to be generated from 1 and increments
forward but every starting day of the year i want it to be start from 1.

example: year 2013

id no name date
1 10 ab 2014-01-01
2 11 cd 2014-01-02
3 12 ef 2014-01-03

when ever the year changes(2015-01-01) depends on the system time and date the application level or
database level should understand to start it from one

4 1 gh 2015-01-01
5 2 ig 2015-02-01
Now year changed to 2016-01-01

6 1 mk 2016-02-01

so where i should set the column NO to work such which out user interfere it should do by
application(PHP) or Database(mysql)

***1- do i need code it on Application(php)? --- any tutorial link
2- is it posible that database(mysql) could understand and do it?***


regards in advance

推荐答案

这篇关于mysql,php,column to generat增加intiger,但每年从一个开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆