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

  • SEARCH
  • Home
  • 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 8065715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:45:21+00:00 2026-06-05T11:45:21+00:00

I have following table structure there is column vid in that i want entry

  • 0

I have following table structure there is column vid in that i want entry todays date followed by 00001 like ‘2012061000001’and when next time table get updated vid should be ‘20120610000002’
when if tommorow table will get update then vid should be 2012061100003

+----+------+-------------+---------+------------+-------------+
| id | vid  | visitorname | company | contact    | whometomeet |
+----+------+-------------+---------+------------+-------------+
|  1 | NULL | rakesh      | godrej  | 9987654123 | abcdef      |
|  2 | NULL | samir       | infosys | 9987654123 | abcdef      |
+----+------+-------------+---------+------------+-------------+

how can we achieve this?

here is my table structure where i set id as auto_increment can we have two fields auto_increment

+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(11)      | NO   | PRI | NULL    | auto_increment |
| vid         | varchar(15)  | YES  |     | NULL    |                |
| visitorname | varchar(255) | YES  |     | NULL    |                |
| company     | varchar(255) | YES  |     | NULL    |                |
| contact     | varchar(30)  | YES  |     | NULL    |                |
| whometomeet | varchar(255) | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+

And firing folowing query i got result like below

insert into visitor(vid)values(concat(replace(left(current_timestamp,10),’-‘,”),lpad(‘1′,’5′,’0’)));

+----+---------------+-------------+---------+------------+-------------+
| id | vid           | visitorname | company | contact    | whometomeet |
+----+---------------+-------------+---------+------------+-------------+
|  1 | NULL          | rakesh      | godrej  | 9987654123 | abcdef      |
|  2 | NULL          | samir       | infosys | 9987654123 | abcdef      |
|  3 | 2012061000001 | NULL        | NULL    | NULL       | NULL        |
+----+---------------+-------------+---------+------------+-------------+

but problem is each time i will get that 1 there in vid if tommorow also i run this query i willl get tommorow date but that would be followed by that 00001 i want it 00002.

  • 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-05T11:45:22+00:00Added an answer on June 5, 2026 at 11:45 am

    I’d suggest you don’t want to combine columns like that – it makes running queries relating to those fields a real pain (i.e. inefficient…)

    Instead, have a date column and an vid column. e.g.

    +----+----------+------+-------------+---------+------------+-------------+
    | id | date     | vid  | visitorname | company | contact    | whometomeet |
    +----+----------+------+-------------+---------+------------+-------------+
    |  1 | 20120610 |    1 | rakesh      | godrej  | 9987654123 | abcdef      |
    |  2 | 20120610 |    2 | samir       | infosys | 9987654123 | abcdef      |
    +----+----------+------+-------------+---------+------------+-------------+
    

    Then you can select on events on a given date.

    Depending upon what your use case is, you could even make vid an AUTO_INCREMENT. (Although at that point, it’s hard to tell the difference between id and vid.)

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

Sidebar

Related Questions

I have table with following structure and test records: +--------+--------+---------+ | vid | number
I have an XML structure like the following: <tables> <table name=tableName1> <row ID=34 col1=data
I have the following table structure (in MySQL): DocID, Code, IsDup, DopOf , where
I have the following table structure. A | B | C I wish to
I have the following table structure, which is imported into an Entity Framework project:
I have the following MySQL table structure: num field company phone website 1 Gas
I have no control over database schema and have the following (simplified) table structure:
I have table with following structure Whenever user click on checkbook and click on
I have table with following structure and records. table t1 +------+-------------+---------------------+ | name |
Lets say I have the following MySQL structure: CREATE TABLE `domains` ( `id` INT(10)

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.