MySQL/SQL query

Advertisement


Question
Hi,
Before asking my question I think it is better to explain about the table that I want to use.
In table A I have information about projects. Every year we create two project, season 1 and 2 and for example we show it 1234567121. The three first numbers are common for all , the next four numbers are unique and the three last numbers shows which year and season.For example: 1234856131
Part1: 123 are common for all
Part2: 4856 is unique and
Part3: 131 show 2013 season 1( The first six months)

For example in table A for projectnr that start with 1234856 I have:
...
1234856081
1234856082
1234856091
1234856092
1234856101
1234856102
1234856111
1234856112
1234856121
1234856122
1234856131

I try to write an SQL query that when I run it shows me just projectnr from 2009 to 2013(1234856091,1234856092,1234856101,1234856102,1234856111,1234856112,1234856121,1234856122,1234856131)

In table A there are more than 100 projectnr with different numbers in Part2, for example: 1233621121,1239687122,1236995081,1236321111,...

Could you help me to write it?

Regards.

Answer
Dear Sir

to extract what you require from the database would be extremely stressful to the server the large your database grows, you would need to select each then with each run through a while loop to see if the numbers fit a pattern.

I would suggest a much simpler database setup, this would be a lot simpler and better in the long run

MySQL

All Answers


Answers by Expert:


Ask Experts

Volunteer


stuart gregory

Expertise

PHP html, xhtml, css coding and MySQL

Experience

My experiance is all first had as I am web developer and I have, and do build many websites all using php and mysql. This ranges from building a simple search engine to secure php login scripts. Some websites like http://www.web-application-development.info are complete database driven websites.

Organizations
I have a large number of websites which I host and maintain, such as. http://www.webreger.com http://www.universalscience.co.uk http://www.modellingelectronics.co.uk

Education/Credentials
Web application development. (Open University) BSC Honers Computing and development (Open University)

©2016 About.com. All rights reserved.