• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mysql - Load data infile query

 
Ranch Hand
Posts: 47
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm developing a Java swing application with back end Database MySQL . I've a screen to upload my datas to the Database using the Query like

.

Here the datas are like from January to June. But if i want to skip any month data or to upload only a particular month then how will i modify the above query.

In my database table , the date column is 'SLDATE'.

Any suggestions please.?

 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the docs, the LOAD DATA statement doesn't have any option to filter rows based on their column values.

If the date column is first in your input file, you might perhaps be able to import a specific month by using the LINES STARTING BY clause and further tweaking, but I'd say such a solution would be too fragile.

Other than this, you'll probably have to load the contents of the file into a temporary table and then use INSERT INTO ... SELECT to select just the desired subset of rows to insert into the target table.
reply
    Bookmark Topic Watch Topic
  • New Topic