Query question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chrisjc
    Contributor
    • Nov 2006
    • 375

    Query question

    I have a database full of information And I use part numbers to find / query the results on the page I have made now.. However I am in need of a new type of query and I am not 100% sure how to come about this…


    Here is the goal.

    I have a set of part numbers in the database that are 90-10000 to 90-99999

    I need a query that will search JUST those part numbers and then Display.. The displaying part I am sure I can get on my own… I will post the code as I go but I am in need of telling the php that you need to look for these PART NUMBERS first then display this information about them from the selected columns.

    Could anyone help me start this query?
  • kovik
    Recognized Expert Top Contributor
    • Jun 2007
    • 1044

    #2
    MySQL has both a SUBSTR()/SUBSTRING() function and a REGEXP clause that would be of use to you.

    Comment

    • Chrisjc
      Contributor
      • Nov 2006
      • 375

      #3
      Originally posted by volectricity
      MySQL has both a SUBSTR()/SUBSTRING() function and a REGEXP clause that would be of use to you.

      eh? Well I guess I should be a little more specific in what I am looking to do.

      It is when a USER CLICKS a link it will LOAD a new page that must trigger the QUERY and search for those part-numbers 90-10000 through 90-99999 only and then display the found results in the rows across...

      so if my database looked like this

      PARTNUMBER DESC DESC2 PRICE
      90-10420 Cleaner All filters 20.00


      so if that was all that was in there.. it would just display that.... on the screen.

      I just don't know how to structure it to LOAD the page and Trigger a QUERY to take place.... I believe if I can get that I will have no issues with it calling the COLUMNS I will need after... I just haven’t known something this advanced before.

      and when I say find any part number from 90-10000 to 90-99999

      I mean all the numbers possible in between those 2 part numbers.

      Any Ideas? Anyone?

      Comment

      • kovik
        Recognized Expert Top Contributor
        • Jun 2007
        • 1044

        #4
        Oh. I thought you wanted part of the number.

        When you use the ORDER BY clause, MySQL automatically orders the rows numerically and alphabetically. You could combine that with the BETWEEN clause to retrieve all of those table rows between those two values, and use the part number as the id.

        Comment

        Working...