Error code 1366 incorrect integer value for column

hi every one i have a problem in mysql my table is CREATE TABLE IF NOT EXISTS `contactform` ( `contact_id` int(11) NOT NULL AUTO_INCREMENT, `firs...

hi every one i have a problem in mysql

my table is

          CREATE TABLE IF NOT EXISTS `contactform` (
                  `contact_id` int(11) NOT NULL AUTO_INCREMENT,
                    `first_name` varchar(50) NOT NULL,
                  `addition` varchar(50) NOT NULL,
                     `surname` varchar(50) NOT NULL,
                  `Address` varchar(200) NOT NULL,
                   `postalcode` varchar(20) NOT NULL,
                        `city` varchar(50) NOT NULL,
                      `phone` varchar(20) NOT NULL,
                      `emailaddress` varchar(30) NOT NULL,
                           `dob` varchar(50) NOT NULL,
                               `howtoknow` varchar(50) NOT NULL,
                          `othersource` varchar(50) NOT NULL,
                             `orientationsession` varchar(20) NOT NULL,
                               `othersession` varchar(20) NOT NULL,
                                  `organisation` int(11) NOT NULL,
                                      `newsletter` int(2) NOT NULL,
                                      `iscomplete` int(11) NOT NULL,
                          `registrationdate` date NOT NULL,
                            PRIMARY KEY (`contact_id`)
                     ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=39 ;



             mysql>insert into contactform values('','abhi','sir','shukla','vbxcvb','342342','asdfasd','234234234','abhi@gmail.com','1999/5/16','via vrienden of familie','','19','20','6','1','1','2010-03-29')

i get following error.
#1366 — Incorrect integer value: » for column ‘contact_id’ at row 1

this query work fine on my local machine but give error on server

I’ve been trying to upload a CSV table into my remote server database but I find an error. I use MySQL in a RedHat Linux distrib. My mycsv.csv file looks like this:

aa,ProductDescription,country,potato,L,11/18/2013,N,05

bb,ProductDescription,country,tomato,L,12/31/9999,N,05

cc,ProductDescription,country,curry,M,01/01/2014,Y,05

dd,ProductDescription,country,spicy,V,05/01/2015,N,

As you may see, last line ends with comma «,» without having any field (it is empty and should be like this or even better if I can change it to NULL). However when I type the following query:

LOAD DATA INFILE "/home/mycsv.txt" 
INTO TABLE inbound.master_data  
FIELDS TERMINATED BY ','  
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY 'rn';

I get the following error in the command line

Error Code: 1366. Incorrect integer value: » for column
‘product_life_cycle’ at row 4

Does anybody know how to set a null value after the comma in the last line?
(I think this is the problem why I can’t upload my table). Thank you very much in advance.

The table definition:

CREATE TABLE master_data
  ( aa varchar(6) NOT NULL, 
    bb varchar(50) NOT NULL, 
    cc varchar(3) NOT NULL, 
    dd varchar(2) NOT NULL, 
    ee varchar(1) DEFAULT NULL, 
    ff varchar(20) NOT NULL, 
    gg varchar(1) NOT NULL, 
    hh int(11) DEFAULT NULL, 
    PRIMARY KEY (aa), 
    UNIQUE KEY aa_UNIQUE (aa) 
) ENGINE=InnoDB 
  DEFAULT CHARSET=latin1 ;

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

1 2009-12-14 00:26:28

  • aler
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2009-12-13
  • Сообщений: 7

Тема: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Уважаемые форумчане, ОЧЕНЬ СРОЧНО НУЖНА ВАША ПОМОЩЬ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
При добавлении данных в таблицу выдает ошибку (#1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In)
Как ее решить????
вот таблица:
Поле                        Тип                      Ноль                По умолчанию              Допольнительно
id                              int(4)                          Да                                NULL                       auto_increment
title                           varchar(255)               Да                                NULL
description                 text                            Да                                NULL
text                           text                            Да                                NULL
date                          date                           Да                                000-00-00
author                       varchar(255)               Да                                NULL 

а вот запрос на добавление инфи:

mysql_query(«INSERT INTO news (title,description,text,date,author) VALUE (‘$title’,’$description’,’$text’,’$date’,’$author’)»);

2 Ответ от Hanut 2009-12-14 00:51:26

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

aler
В таблице уберите у поля id значение по умолчанию. В поле «Ноль» должно быть «нет», в поле «По умолчанию» — тоже «нет». Так же поле id должно быть первичным ключом (проверьте индекс).

3 Ответ от aler 2009-12-14 09:57:04 (изменено: aler, 2009-12-14 10:00:09)

  • aler
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2009-12-13
  • Сообщений: 7

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Hanut сказал:

aler
В таблице уберите у поля id значение по умолчанию. В поле «Ноль» должно быть «нет», в поле «По умолчанию» — тоже «нет». Так же поле id должно быть первичным ключом (проверьте индекс).

я сам над этим думал. НО! при создании таблицы я все значения ставлю NOT NULL  и в самой структуре таблицы после создания тоже стоят эти значения. А после того как просматриваешь свойства таблици все значения становятся в NULL. Сколько раз не пробовал поменять все равно тоже самое.
id у меня является первичным ключом. Может это глюк самого phpmyadmina или mysql?
И еще, когда вручную указываешь id все данные занюсятся в таблицу.

4 Ответ от Hanut 2009-12-14 12:14:01

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

aler
Попробуйте найти конфигурационный файл MySQL (my.ini./my.cnf) и поправить в нем строку (если она выглядит иначе):
sql-mode=»STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION»

5 Ответ от aler 2009-12-14 14:51:45

  • aler
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2009-12-13
  • Сообщений: 7

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Hanut сказал:

aler
Попробуйте найти конфигурационный файл MySQL (my.ini./my.cnf) и поправить в нем строку (если она выглядит иначе):
sql-mode=»STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION»

в своем MySQL нашел файл my.cnf но там вообще такой строки нету.
Кстате auto_increment начинает работать когда добавишь пару записей вручную с указанием id. После этого спокойно добавляет с формы.
Ничего не могу понять……..

6 Ответ от Hanut 2009-12-14 22:31:13

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Попробуйте добавить эту строку в my.cnf, в раздел [mysqld].

Не должно быть, чтобы без выставления NULL оно добавлялось автоматически.

7 Ответ от aler 2009-12-15 01:44:41

  • aler
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2009-12-13
  • Сообщений: 7

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Hanut сказал:

Попробуйте добавить эту строку в my.cnf, в раздел [mysqld].

Не должно быть, чтобы без выставления NULL оно добавлялось автоматически.

Вставил эту строчку куда вы сказали. Никаких изменений.

И еще один вопросик: Какую кодировку использовать  когда добавляешь данные на русском или украинском языке? а то в базе отображаются знаки вопроса (?????)

8 Ответ от Hanut 2009-12-15 13:13:45

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

aler
Кодировка в БД зависит от кодировки страниц сайта: если сайт в windows-1251, то таблицы должны иметь сравнение cp1251_general_ci; если в utf-8, то utf8_general_ci.

Если вы сами пишите скрипт вставки данных, то обязательно сразу после функции mysql_connect добавьте строку определяющую кодировку соединения с MySQL:

mysql_query('SET NAMES cp1251'); // utf8 - для страниц в кодировке utf-8.

9 Ответ от aler 2009-12-15 14:18:28

  • aler
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2009-12-13
  • Сообщений: 7

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Hanut сказал:

aler
Кодировка в БД зависит от кодировки страниц сайта: если сайт в windows-1251, то таблицы должны иметь сравнение cp1251_general_ci; если в utf-8, то utf8_general_ci.

Если вы сами пишите скрипт вставки данных, то обязательно сразу после функции mysql_connect добавьте строку определяющую кодировку соединения с MySQL:

mysql_query('SET NAMES cp1251'); // utf8 - для страниц в кодировке utf-8.

Большое спасибо. вот это мне и нужно было.

10 Ответ от aler 2009-12-21 22:12:58

  • aler
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2009-12-13
  • Сообщений: 7

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Все равно ничего не пойму, почему id не ставится автоматически… и как не крутил NULL ставится само по себе.

11 Ответ от Hanut 2009-12-22 00:10:45

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

aler
Скопируйте сюда структуру таблицы. Пока у меня нет идей почему так получается.

12 Ответ от aler 2009-12-22 00:15:15

  • aler
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2009-12-13
  • Сообщений: 7

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Hanut сказал:

aler
Скопируйте сюда структуру таблицы. Пока у меня нет идей почему так получается.

Поле           Тип               Сравнение       Атрибуты      Ноль      По умолчанию      Дополнительно
id                int(4)                                                       Да          NULL                    auto_increment
login            varchar(20)                                              Да          NULL
password     varchar(20)                                              Да          NULL

вот такая структура.

13 Ответ от Hanut 2009-12-22 12:07:00

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

aler
Я имел в виду структуру в виде SQL запроса. Увидеть ее можно если выбрать таблицу, затем перейти на страницу экспорта, там убрать галочку в блоке данных и не выставлять галочку сохранения в файл. Тогда структура будет выведена прямо в phpMyAdmin.

14 Ответ от Hanut 2010-05-20 11:56:07

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,723

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

alex252003
Строка
SET SQL_MODE=»NO_AUTO_VALUE_ON_ZERO»;
Будет в дампе всегда, это необходимо для корректной вставки значений в поле имеющее параметр автоувеличения (AUTO_INCREMENT).

Влияет режим NO_AUTO_VALUE_ON_ZERO только на те значения, которые для поля id будут нулем. Если в дампе есть такие значения, значит будет выводиться ошибка.

В крайнем случае, можете перед импортом дампа закомментировать строку таким образом:
— SET SQL_MODE=»NO_AUTO_VALUE_ON_ZERO»;

15 Ответ от alex252003 2010-05-20 12:08:13

  • alex252003
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2010-05-20
  • Сообщений: 2

Re: #1366 — Incorrect integer value: » for column ‘id’ at row 1#1366 — In

Hanut сказал:

alex252003
Строка
SET SQL_MODE=»NO_AUTO_VALUE_ON_ZERO»;
Будет в дампе всегда, это необходимо для корректной вставки значений в поле имеющее параметр автоувеличения (AUTO_INCREMENT).

Влияет режим NO_AUTO_VALUE_ON_ZERO только на те значения, которые для поля id будут нулем. Если в дампе есть такие значения, значит будет выводиться ошибка.

В крайнем случае, можете перед импортом дампа закомментировать строку таким образом:
— SET SQL_MODE=»NO_AUTO_VALUE_ON_ZERO»;

спасибо уже разобрался, окзалось дело в кодировке, я поставил в файле my.ini кодировку:
default-character-set=cp1251
и в таблице поставил сравнение cp1251_general_ci
и все заработало

зы я свое сообщение удалил а потом только увидел что вы уже ответили smile

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

@sdprovider77

Hello to everybody !
Could someone kindly help me? I’m trying to install MentionMe about ACP and when i click ‘install’ this is the error of mysql :

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1366 — Incorrect integer value: ‘NULL’ for column ‘sid’ at row 1
Query:
INSERT INTO mybb_settings (sid,name,title,description,optionscode,value,disporder,gid) VALUES (‘NULL’,’mention_auto_complete’,’Auto-Complete Mentions?’,’YES (default) to autocomplete mentions as they are typed on showthread in Quick Reply and full post/edit pages’,’yesno’,’1′,’10’,44), (‘NULL’,’mention_max_items’,’Maximum Items In Popup’,’if autocomplete is used, this setting will limit the size of the popup’,’text’,’5′,’20’,44), (‘NULL’,’mention_get_thread_participants’,’Retrieve Thread Participants?’,’YES (default) to include and proritize highly names of users who have participated in the current thread’,’yesno’,’1′,’30’,44), (‘NULL’,’mention_full_text_search’,’Full Text Search?’,’YES to match characters in the autocomplete popup anywhere in the username, NO (default) to search for usernames that start with the typed characters’,’yesno’,’0′,’40’,44), (‘NULL’,’mention_show_avatars’,’Show User Avatars?’,’YES (default) to show user avatars in the autocomplete popup, NO to show usernames only’,’yesno’,’1′,’50’,44), (‘NULL’,’mention_add_postbit_button’,’Add a Postbit Button?’,’YES to add a button to each post allowing users to tag multiple members to mention (NO by default)’,’yesno’,’0′,’60’,44), (‘NULL’,’mention_multiple’,’Multiple Mentions?’,’YES (default) to mimic the multi-quote feature or NO to instantly insert the mention on click

The postbit button setting must be set to YES for this setting to take effect‘,’yesno’,’0′,’70’,44), (‘NULL’,’mention_format_names’,’Format Usernames?’,’YES (default) to format user names according to their display group, NO to format mentions as plain links’,’yesno’,’1′,’80’,44), (‘NULL’,’mention_display_symbol’,’Display Symbol’,’Set this to @ or another symbol to use to prefix mentions, leave blank for no prefix’,’text’,’@’,’90’,44), (‘NULL’,’mention_cache_time’,’Cache Cut-off Time’,’The task caches usernames based on when they were last active. In days, specify how far back to go. (Large forums should stick with low numbers to reduce the size of the namecache)’,’text’,’7′,’100′,44), (‘NULL’,’mention_minify_js’,’Minify JavaScript?’,’YES (default) to serve client-side scripts minified to increase performance, NO to serve beautiful, commented code ;)’,’yesno’,’1′,’110′,44), (‘NULL’,’mention_advanced_matching’,’Enable Advanced Matching?’,’This option allows user names with whitespace to be processed by MentionMe without the necessity of enclosing user names in double quotes.

This feature can greatly increase the server load and is not recommended for large forums.’,’yesno’,’0′,’120′,44)

Please could someone help me ?

Thank you very much !

@WildcardSearch

Thanks for the report. I’ll have a look asap

@chope1

Still getting the same error on Installation.

`MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1366 — Incorrect integer value: ‘NULL’ for column ‘sid’ at row 1
Query:
INSERT INTO mybb_settings (sid,name,title,description,optionscode,value,disporder,gid) VALUES (‘NULL’,’mention_auto_complete’,’Auto-Complete Mentions?’,’YES (default) to autocomplete mentions as they are typed on showthread in Quick Reply and full post/edit pages’,’yesno’,’1′,’10’,37), (‘NULL’,’mention_max_items’,’Maximum Items In Popup’,’if autocomplete is used, this setting will limit the size of the popup’,’text’,’5′,’20’,37), (‘NULL’,’mention_get_thread_participants’,’Retrieve Thread Participants?’,’YES (default) to include and proritize highly names of users who have participated in the current thread’,’yesno’,’1′,’30’,37), (‘NULL’,’mention_full_text_search’,’Full Text Search?’,’YES to match characters in the autocomplete popup anywhere in the username, NO (default) to search for usernames that start with the typed characters’,’yesno’,’0′,’40’,37), (‘NULL’,’mention_show_avatars’,’Show User Avatars?’,’YES (default) to show user avatars in the autocomplete popup, NO to show usernames only’,’yesno’,’1′,’50’,37), (‘NULL’,’mention_add_postbit_button’,’Add a Postbit Button?’,’YES to add a button to each post allowing users to tag multiple members to mention (NO by default)’,’yesno’,’0′,’60’,37), (‘NULL’,’mention_multiple’,’Multiple Mentions?’,’YES (default) to mimic the multi-quote feature or NO to instantly insert the mention on click

The postbit button setting must be set to YES for this setting to take effect‘,’yesno’,’0′,’70’,37), (‘NULL’,’mention_format_names’,’Format Usernames?’,’YES (default) to format user names according to their display group, NO to format mentions as plain links’,’yesno’,’1′,’80’,37), (‘NULL’,’mention_display_symbol’,’Display Symbol’,’Set this to @ or another symbol to use to prefix mentions, leave blank for no prefix’,’text’,’@’,’90’,37), (‘NULL’,’mention_cache_time’,’Cache Cut-off Time’,’The task caches usernames based on when they were last active. In days, specify how far back to go. (Large forums should stick with low numbers to reduce the size of the namecache)’,’text’,’7′,’100′,37), (‘NULL’,’mention_minify_js’,’Minify JavaScript?’,’YES (default) to serve client-side scripts minified to increase performance, NO to serve beautiful, commented code ;)’,’yesno’,’1′,’110′,37), (‘NULL’,’mention_advanced_matching’,’Enable Advanced Matching?’,’This option allows user names with whitespace to be processed by MentionMe without the necessity of enclosing user names in double quotes.

This feature can greatly increase the server load and is not recommended for large forums.’,’yesno’,’0′,’120′,37)`

@WildcardSearch

Sorry, I haven’t had much time to maintian my MyBB plugins lately. The error is caused by the values in inc/plugins/MentionMe/install_data.php for the SID field. Changing them to the number 0 rather than 'NULL' or whatever they are currently will solve the issue.

Member Avatar

11 Years Ago

Hi I am trying to build a MySQL database. I have made a table where some fields are VARCHAR and others are INT. All of them are null. One of the columns I made is Vote which is INT(5).
Now I am trying to import data from a text file. The problem is, some of the rows in the column Vote are blank.
As a result, MySQL giving me ERROR 1366 which says the following:
«Incorrect integer value: ‘ ‘ for column ‘Vote’ at row 1»
Tried making the column NOT NULL using the ALTER TABLE command..didn’t work..
Would you please tell me how to fix it?
Thanks

Edited

11 Years Ago
by ghosh22 because:

n/a


Recommended Answers

Try creating a table having the same column names whose columns are all VARCHAR and import your data into that. That should work as long as your VARCHAR columns are big enough. Then you can write a query that reads the data from this all-VARCHAR table and INSERTs into the …

Jump to Post

If you have generated the text file on a Windows system, you might have to use LINES TERMINATED BY ‘rn’ to read the file properly, because Windows programs typically use two characters as a line terminator. Some programs, such as WordPad, might use r as a line terminator when writing …

Jump to Post

All 8 Replies

Member Avatar


d5e5

109



Master Poster


11 Years Ago

Try creating a table having the same column names whose columns are all VARCHAR and import your data into that. That should work as long as your VARCHAR columns are big enough. Then you can write a query that reads the data from this all-VARCHAR table and INSERTs into the table you want to populate. That seems like a roundabout way to do it, but I used to do that a lot years ago when I had problems importing a file. If you have to convert a value from VARCHAR to INT, it’s easier to handle that in your insert query that selects from your intermediate table.

Member Avatar


ghosh22

0



Junior Poster in Training


11 Years Ago

Hi Thanks for your reply. I tried making a test table to populate with my data where some data are missing as well like before. But now the problem is different which you could see from this image. The first Country column VARCHAR(20) is not coming properly! Country names are like Australia, Greece etc..
[IMG]http://i56.tinypic.com/2cnfri9.jpg[/IMG]
But missing data in columns City, Age are loading properly now..
Please note that, I am doing all these in my Windows computer. I saved the data first in .xlsx format and then saved them as tab delimited text.
Command used to load data:
LOAD DATA INFILE «J/MySQL/test.txt» INTO TABLE test;
Thanks..

Edited

11 Years Ago
by ghosh22 because:

n/a

Member Avatar


d5e5

109



Master Poster


11 Years Ago

Hi Thanks for your reply. I tried making a test table to populate with my data where some data are missing as well like before. But now the problem is different which you could see from this image. The first Country column VARCHAR(20) is not coming properly! Country names are like Australia, Greece etc..
[IMG]http://i56.tinypic.com/2cnfri9.jpg[/IMG]
But missing data in columns City, Age are loading properly now..
Please note that, I am doing all these in my Windows computer. I saved the data first in .xlsx format and then saved them as tab delimited text.
Command used to load data:
LOAD DATA INFILE «J/MySQL/test.txt» INTO TABLE test;
Thanks..

If you attach your test.txt tab delimited file to your post we could test the import and try to replicate the error.

Member Avatar


ghosh22

0



Junior Poster in Training


11 Years Ago

If you attach your test.txt tab delimited file to your post we could test the import and try to replicate the error.

Hi Please check my attached tab delimited .txt file. Also is there no other way of inserting missing INT fileds?
Thanks

Member Avatar


d5e5

109



Master Poster


11 Years Ago

If you have generated the text file on a Windows system, you might have to use LINES TERMINATED BY ‘rn’ to read the file properly, because Windows programs typically use two characters as a line terminator. Some programs, such as WordPad, might use r as a line terminator when writing files. To read such files, use LINES TERMINATED BY ‘r’.

see note in docs for LOAD DATA
The following works on my linux computer. (I don’t have MySQL on Windows.)

DROP TABLE IF EXISTS `all_text`;
CREATE TABLE `all_text`(
`country` VARCHAR(20),
`some_nbr` VARCHAR(20),
`city` VARCHAR(20),
`gender` VARCHAR(20),
`vote` VARCHAR(20)
) ENGINE = MYISAM;

#Change the file path to get this to run on your computer
LOAD DATA LOCAL INFILE "/home/david/Programming/data/test.txt" INTO TABLE all_text
LINES TERMINATED BY 'rn';

SELECT * FROM all_text;

The result of the above is

+-----------+----------+------+--------+----------+
| country   | some_nbr | city | gender | vote     |
+-----------+----------+------+--------+----------+
| Australia | Sydney   | 55   | M      | 245254   |
|           | Beijing  | 65   | M      | 22254    |
| Greece    | Athens   |      | F      | 2222AVG5 |
| Thailand  | Bangkok  | 42   | M      | 76577    |
| Malayasia |          | 22   | M      | 7676578  |
| Japan     | Tokyo    | 75   | F      | 987765   |
| Chile     | Santiago | 58   | F      | 5453ASD  |
| Russia    | Moscow   | 75   | F      | 343545   |
| Uganada   |          |      | M      | 676867   |
| Canada    | Montreal | 77   | M      | 4544345  |
+-----------+----------+------+--------+----------+

Member Avatar


ghosh22

0



Junior Poster in Training


11 Years Ago

Thanks a lot!! It works..I think my mistake was in the command as I missed ‘Local’ and ‘Lines terminated’ parts.
I have one more question. Searched Google for it but no help. I think I am searching wrong terms.
I have attached another small tab delimited text file attached here. I want the corresponding rows should come. For eg. If I select Country=»England», then I want the output with all the corresponding cities and Particiapnats.
So the output table should look like:

Country  Cities Participants
England     Taunton   225
            Bristol   654
            Plymouth  585
England     London    552
            Exeter    235
            Leeds     445

I tried using LIMIT but no luck (or I am not using it correctly!) (Please note that the numbers showing here is not part of my table!)
Please suugest..
Thanks

Edited

11 Years Ago
by ghosh22 because:

n/a

Member Avatar


d5e5

109



Master Poster


11 Years Ago

Thanks a lot!! It works..I think my mistake was in the command as I missed ‘Local’ and ‘Lines terminated’ parts.
I have one more question. Searched Google for it but no help. I think I am searching wrong terms.
I have attached another small tab delimited text file attached here. I want the corresponding rows should come. For eg. If I select Country=»England», then I want the output with all the corresponding cities and Particiapnats.
So the output table should look like:

Country  Cities Participants
England     Taunton   225
            Bristol   654
            Plymouth  585
England     London    552
            Exeter    235
            Leeds     445

I tried using LIMIT but no luck (or I am not using it correctly!) (Please note that the numbers showing here is not part of my table!)
Please suugest..
Thanks

Your input table has no country associated with most of the cities, such as Bristol, Plymouth, Exeter and Leeds. When you write a SELECT query you can easily retrieve the rows that contain ‘England’, but of course that will miss the rows where country is null. I don’t know of any way around that except to manually fill in all null values in the country column with the appropriate country. You know that Leeds is in England, but MySQL does not.

Member Avatar


ghosh22

0



Junior Poster in Training


11 Years Ago

hmm.thats really a hard work ’cause I have a lot of data like this and manually filling them is a pain!
Anyway..thanks for your help…


Reply to this topic

Be a part of the DaniWeb community

We’re a friendly, industry-focused community of developers, IT pros, digital marketers,
and technology enthusiasts meeting, networking, learning, and sharing knowledge.

Понравилась статья? Поделить с друзьями:
  • Error code 1356
  • Error code 1355
  • Error code 11 1315
  • Error code 135
  • Error code 1329 no data zero rows fetched selected or processed