Re: Two Primary Keys

2010-06-29 Thread Dušan Pavlica
Hi, try this and you will see exactly how autoincrement behaves in MyISAM tables when it is part of primary key. 1) declare table like this: CREATE TABLE `test_tbl` ( `field1` int(10) unsigned NOT NULL default '0', `field2` int(10) unsigned NOT NULL auto_increment, `field3` char(10) NOT

Re: Complex conditional statement during select

2008-08-28 Thread Dušan Pavlica
Try this: SELECT this, that, theOther, SUM(IF(SUBSTRING(myDate,1,10) = '20080101' AND SUBSTRING(myDate,1,10) = '20080131', 1, 0)) AS `January` FROM theTable GROUP BY theOther Problem was in parentheses Dusan Jay Blanchard napsal(a): SELECT this, that, theOther, SUM(IF(SUBSTRING(myDate,1,10)

Re: Need help to query with timestamp in C++

2008-08-15 Thread Dušan Pavlica
Hi Kandy, this could be the query you are looking for. It should return record with the closest timestamp to your required time: (SELECT TIMEDIFF('20080815091907', timestamp_column) AS diff, t.* FROM table1 t WHERE timestamp_column = '20080815091907' ORDER BY timestamp_column DESC LIMIT 1 )

Re: Lost Connection each hour :(

2008-01-16 Thread Dušan Pavlica
Marco, can you post values of wait_timeout and interactive_timeout variables. You can get them from SHOW VARIABLES output. If they are set to 3600 (1 hour in secs), set them to something bigger like one week and then you will see if it helps or not. You can read more about those timeouts also

Re: Lost Connection each hour :(

2008-01-16 Thread Dušan Pavlica
MAS! napsal(a): can you post values of wait_timeout and interactive_timeout variables. You can get them from SHOW VARIABLES output. If they are set to 3600 (1 hour in secs), set them to something bigger like one week and then you will see if it helps or not. You can read more about

Re: load data infile and character set

2007-10-29 Thread Dušan Pavlica
Are you sure your file is coded in utf8? Character set of your file must be same as charset of your database. Dusan Caleb Racey napsal(a): Does anyone know how to get the load data infile command to load utf8 data? I have setup a database as utf8 with a collation of utf8_general_ci, the

Re: utf8 problem in index

2007-09-05 Thread Dušan Pavlica
Marten Lehmann napsal(a): Hello, I have a table like this: CREATE TABLE `places` ( `name` varchar(256) collate utf8_unicode_ci NOT NULL, PRIMARY KEY (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci | Then I want to insert two values: pjöngjang.com and pjongjang.com

Re: LOAD DATA INTO doesn't work correctly with utf8

2007-08-30 Thread Dušan Pavlica
Edward Kay napsal(a): I would like to import data from a utf8-coded comma seperated file. I created my database with DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci and I started my mysql-client with the --default-character-set=utf8 option. Nevertheless, when I input primary key fields, which

Re: LOAD DATA INTO doesn't work correctly with utf8

2007-08-30 Thread Dušan Pavlica
Harald Vajkonny napsal(a): Ananda Kumar schrieb: strange. did u exit and reconnect and did the select? Yes, I tried it once more. I have to put the USE command before I change session settings to latin to make it work without error (otherwise I still get the duplicate message). But

Re: LOAD DATA INTO doesn't work correctly with utf8

2007-08-30 Thread Dušan Pavlica
Harald Vajkonny napsal(a): Dušan Pavlica schrieb: Try to convert file to latin1, if it's possible, create database with latin1 charset, create table with required structure (you can set utf8 charset to string fields ) and then load data. I can not convert the file into latin1

Re: mysqldump problem with large innodb tables...

2007-06-19 Thread Dušan Pavlica
Try to look for Lost connection error in MySQL manual and it can give your some hints like http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html Dusan Hartleigh Burton napsal(a): Hi All, I have a database which is currently at ~10GB in it's test phase. It is containing uncompressed

Re: select first letters

2007-04-25 Thread Dušan Pavlica
I'm not sure, but I think that greek characters are sorted after English chars so try this: SELECT DISTINCT LEFT(title,1) FROM odigos_details WHERE LEFT(title,1) 'z' ORDER BY title HTH, Dusan nikos napsal(a): Hello list. I want to select discinct the first letters of titles in a UTF8

Re: Borland C++ Builder 2006 DLL Woes

2007-02-21 Thread Dušan Pavlica
I had to buy dbExpress libraries for MySQL from third party. Dusan [EMAIL PROTECTED] napsal(a): We just purchased The Borland Developer Studio 2006 IDE and are having significant problems using dbExpress objects to communicate with MySQL servers (both 4 and 5). Curiously, we can perform

Re: need a select query

2007-02-12 Thread Dušan Pavlica
select * from table1 order by field1 limit 10,1 Dusan balaraju mandala napsal(a): Hi All, I need a select query, with which i can reach to a particular row directly. I mean if a table have 100 rows inserted, we can use select * from table1 limit 10; with this query i will have 10 rows,

Re: running sum with a @variable

2007-02-06 Thread Dušan Pavlica
try to put parenthesis around @runsum := @runsum + SUM(db.Jan+db.Feb+db.Mar) SELECT @row := @row+1 AS `Row`, mycountries.Name AS `Country` , ROUND(SUM(db.Jan+db.Feb+db.Mar)) AS `Q1` , (@runsum := @runsum + SUM(db.Jan+db.Feb+db.Mar)) AS `RunSum` FROM data2006 AS db LEFT JOIN mycountries ON

Re: SET @var and insert that as cunting var into table with insertselect

2007-02-05 Thread Dušan Pavlica
Barry napsal(a): Dušan Pavlica schrieb: Barry napsal(a): Hello Everyone! I am having a big problem with counting inserting rows. This is my Query: SELECT MAX(id) INTO @maxid FROM table1; // @maxid is now 44 INSERT INTO table2 (orderid, someothervars) SELECT @maxid +1, blahvar FROM

Re: SET @var and insert that as cunting var into table with insert select

2007-02-02 Thread Dušan Pavlica
Barry napsal(a): Hello Everyone! I am having a big problem with counting inserting rows. This is my Query: SELECT MAX(id) INTO @maxid FROM table1; // @maxid is now 44 INSERT INTO table2 (orderid, someothervars) SELECT @maxid +1, blahvar FROM table3; try select @maxid:=max(id)-1 from

Re: CONCAT(int_col, string_col) and charset and collation problems

2007-02-01 Thread Dušan Pavlica
as: mysql select charset(concat(tt,CONVERT(id USING latin1))) from test; Thanks ViSolve DB Team - Original Message - From: Dušan Pavlica [EMAIL PROTECTED] To: list mysql mysql@lists.mysql.com Sent: Wednesday, January 31, 2007 5:31 PM Subject: CONCAT(int_col, string_col) and charset

CONCAT(int_col, string_col) and charset and collation problems

2007-01-31 Thread Dušan Pavlica
Hi, I'm using MySQL 4.1.15, WinXP and my problem is that SELECT CHARSET(CONCAT(int_column, string_column)) FROM mytable; always returns charset 'binary' and I need resulting charset to be same as a charset of a string_column because I don't want to look for charset of a column whenever I have

Re: Extracting data from MySQL into Access

2007-01-15 Thread Dušan Pavlica
Shortly, if you have MySQL ODBC driver installed, you can create ODBC data source and connect to this data source from Access, Excel, Open Office, Dusan Dewald Troskie napsal(a): Hi, I know this is a weird request, but I need a tool / tutorial on extracting data from InnoDB tables in

Re: Need any that can translate this

2007-01-11 Thread Dušan Pavlica
Temporary tables are stored in memory so they are as quick as joins. Dusan Ran napsal(a): Not necessarily to use temp tables,they are expensicve. Temp tables introduce extra disk IOs which slows down compare to using explicit JOINs which is done in memory. Here is techniques on how to rewrite

Re: MySQL 5.0.27: character problem

2006-12-14 Thread Dušan Pavlica
Eric, I think that you don't have to write a conversion program because MySQL have built-in pretty good character set conversions. All you need to do is to tell MySQL which character set uses your file with your SQL commands. Create your file with one of the character sets MySQL

Re: Convert hex to decimal?

2006-11-06 Thread Dušan Pavlica
Frederic Wenzel napsal(a): Hey, I have a table with a SMALLINT column that -- trough a mistake -- contains values like 57, 13 etc. which in fact are 0x57 and 0x13 (i.e. HEX numbers). How would I convert 13 (false decimal) to 0x13 (Hex) and from there to 19 (decimal)? I tried my luck with

Re: Deleting, skip the first n records

2006-10-05 Thread Dušan Pavlica
If you don't know the cutoff_date you can simply find it by SELECT creation FROM tablename ORDER BY creation DESC LIMIT n, 1 which gives you the creation of the n-th newest record and then you can use Dan's solution DELETE FROM tablename WHERE creation cutoff_date HTH, Dusan Dan Julson

Converting string hex column to integer

2006-06-28 Thread Dušan Pavlica
Hello, I have column of type char(2) containing hex numbers (e.g. 0A, FF, ...) and I cannot find correct function which could convert those hex numbers to integers so I can perform futher calculations. I experimented with HEX(), CAST(), CONVERT() but I wasn't succesfull. Thanks in advance,

Re: Converting string hex column to integer

2006-06-28 Thread Dušan Pavlica
Wolfram Kraus napsal(a): On 28.06.2006 13:54, Dušan Pavlica wrote: Hello, I have column of type char(2) containing hex numbers (e.g. 0A, FF, ...) and I cannot find correct function which could convert those hex numbers to integers so I can perform futher calculations. I experimented with HEX

Strange Illegal mix of collations error

2006-06-16 Thread Dušan Pavlica
Hello, could someone help me to explain and resolve this error? Or maybe it is a bug. DROP TABLE IF EXISTS `test`.`karty`; CREATE TABLE `test`.`karty` ( `ICO` char(12) collate latin2_czech_cs NOT NULL default '', `CisloProvozu` char(6) collate latin2_czech_cs NOT NULL default '', `CisPrac`

Re: Strange Illegal mix of collations error

2006-06-16 Thread Dušan Pavlica
flyerheaven - Barry Krein napsal(a): Dušan Pavlica schrieb: Barry napsal(a): Dušan Pavlica schrieb: Hello, could someone help me to explain and resolve this error? Or maybe it is a bug. DROP TABLE IF EXISTS `test`.`karty`; CREATE TABLE `test`.`karty` ( `ICO` char(12) collate

Re: How can I keep character_set_client value after MyODBC auto reconnect?

2006-01-10 Thread Dušan Pavlica
Hi, did you try SET CHARACTER SET utf8 as Initial Statement under Connection Options of your MyODBC DSN? HTH, Dusan - Original Message - From: 古雷 [EMAIL PROTECTED] To: MySQL List mysql@lists.mysql.com Sent: Monday, January 09, 2006 10:19 AM Subject: How can I keep

Delete query problem

2005-12-21 Thread Dušan Pavlica
Hello, I have master-detail tables and I would like to delete in one statement master record and all detail records but not every master record has details. MySQL versions 4.1.10 and higher. Could someone help me, please, to create such a query? Example: CREATE TABLE `master_tbl` ( `ID`

Re: Delete query problem

2005-12-21 Thread Dušan Pavlica
. Dušan Pavlica napsal(a): Hello, I have master-detail tables and I would like to delete in one statement master record and all detail records but not every master record has details. MySQL versions 4.1.10 and higher. Could someone help me, please, to create such a query? Example: CREATE TABLE

Re: Help with query

2005-10-13 Thread Dušan Pavlica
Shawn, - Original Message - From: [EMAIL PROTECTED] To: Dušan Pavlica Cc: Michael Stassen ; list mysql Sent: Wednesday, October 12, 2005 4:45 PM Subject: Re: Help with query Dušan Pavlica [EMAIL PROTECTED] wrote on 10/12/2005 10:00:53 AM: Thanks, Michal, for your

Help with query

2005-10-12 Thread Dušan Pavlica
Hello, could someone help me please to construct correct query or tell me what I'm doing wrong? I have three tables: table products table products_codes where some products could have assigned another additional codes table products_prices I want to get all rows from product_prices listed

Re: Help with query

2005-10-12 Thread Dušan Pavlica
querries for each DB system separately. Now I see that I will have to. Dusan - Original Message - From: Michael Stassen [EMAIL PROTECTED] To: Dušan Pavlica [EMAIL PROTECTED] Cc: list mysql mysql@lists.mysql.com Sent: Wednesday, October 12, 2005 2:54 PM Subject: Re: Help with query Dušan

Re: Problem with datetime values and MyODBC driver

2005-08-05 Thread Dušan Pavlica
(and different ODBC drivers). And thus I must set query parameters to their correct data types and ODBC driver should do the conversions. And that is what is not working. I will probably fill a bug report and will see. Dusan - Original Message - From: Dwi Putra L To: Dušan Pavlica

Problem with datetime values and MyODBC driver

2005-08-04 Thread Dušan Pavlica
Hello, I'm working in C++ Builder 6.0 and I'm trying to create application which could connect through ADO components to different databases using ODBC drivers. If I create TADOQuery object which has datetime parametr and I fill this parametr with valid datetime value then I can see in MYSQL's

Re: [PARTIALLY SOLVED] Illegal mix of collations for operation IN

2005-06-03 Thread Dušan Pavlica
I did more investigation and found out that 1) with MySQL 4.1.10-nt both queries executed from Query Browser work fine (no error) - I haven't chance to test it with my application through ODBC connection 2) when I set initial statement in MyODBC SET CHARACTER SET 'cp1250' instead of SET NAMES

Illegal mix of collations for operation IN

2005-06-02 Thread Dušan Pavlica
Hello, I have problem which I don't understand. if I send command (from Query Browser or from C++ Builder application) SELECT FileName FROM Files WHERE FileName = 'FILE1.TXT' OR FileName = 'FILE2.TXT' query executes without any problem but command SELECT FileName FROM Files WHERE FileName IN