Results 1 to 4 of 4

Thread: Mysql select query

  1. #1
    Join Date
    Mar 2012
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Mysql select query

    Hi,

    I need a query using tables.

    Here i have some tables in my database table names like

    test_20140405
    test_20140406
    test_20140407
    test_20140408

    in these tables same fields like feeprefix, feetime etc...

    now here i am using php code..

    from date: textbox with name of fromval
    to date: textbox with name of toval
    submit button

    here my question is i slected to dates fromval is 20140405 and toval is 20140407, based on these values i need to get feeprefix, feetime from the test_values between fromval and toval?

    help me out..

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,634
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by udaybabu View Post
    here my question is i slected to dates fromval is 20140405 and toval is 20140407, based on these values i need to get feeprefix, feetime from the test_values between fromval and toval?
    That's not exactly a question…?

    What code have you tried? What problem did you encounter — what happened, compared to what you expected to happen?

    It will likely be necessary to share your database schema as well (e.g., the result from show create table `your-table-name-goes-here`). If you question has anything to do with your PHP and/or HTML, you will need to share that code also.

    Your question is unclear.
    Please provide more information, and be as specific as possible.
    • What do you want to accomplish?
    • What have you already tried?
    • What problems did you encounter?

    Please be sure that you have included all relevant code and/or a link to the page in question.

  3. #3
    Join Date
    Mar 2012
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Thanks for your reply..

    I am not that much experienced person to explain but i will exp my point clearly.

    I have a mysql db tables like

    test_20140405(Date)
    test_20140406(Date)
    test_20140407(Date)
    test_20140408(Date)

    In these tables we have a common fields like feeprefix, feetime.

    db part is over.. now from UI part.. i have a form with 2 fields like from date and to date and submit button.

    now i selected from date and to date like 2014-04-05 and 2014-04-07 respectively and enter the submit button..

    now my prob is take these input fileds and prepare a query to get feeprefix, feetime from the db tables.

    here the date range is 2014-04-05 to 2014-04-07 so now we have db tables with dates..test_20140405 to test__20140408

    according to give dates we have 3 db tables so we get feeprefix, feetime from these 3 tables..


    I hope u got my point..

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,634
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You must provide relevant code if you expect to get help. Making us guess will not help solve your problem.

    In general terms, the date needs to be a field in the table, not its own table. It should also be a DATETIME field, and contain only the date (other info, like "test__" (if that is even needed), should be stored in other fields). This will allow you to search for records between given dates by using the BETWEEN operator.

    Quote Originally Posted by udaybabu View Post
    I am not that much experienced person to explain but i will exp my point clearly.
    That's just fine- that's not a problem. I explained (above) how to find the info we need.

    Again, if you want a more specific answer, show your database schema and the code you are using. You should, of course, obfuscate any private/sensitive information.

Similar Threads

  1. MYSQL Query Shortened
    By bluewalrus in forum PHP
    Replies: 5
    Last Post: 03-16-2011, 03:52 PM
  2. simple SELECT FROM query
    By sniperman in forum MySQL and other databases
    Replies: 2
    Last Post: 07-26-2009, 11:49 PM
  3. Need help with MySQL query...
    By vern1271 in forum MySQL and other databases
    Replies: 0
    Last Post: 08-06-2008, 03:51 PM
  4. pls help me on MySQL query......
    By Rai_87 in forum MySQL and other databases
    Replies: 3
    Last Post: 05-26-2008, 04:34 AM
  5. mySQL query?!
    By nikomou in forum MySQL and other databases
    Replies: 3
    Last Post: 03-11-2007, 03:47 PM

Tags for this Thread

Bookmarks

Posting Permissions

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