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
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: 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: load data infile and character set

2007-10-28 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 mys

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
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 l

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). Bu

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, whic

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 a

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 tabl

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 insert

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, but

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 db.Cou

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 tabl

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

2007-02-01 Thread Dušan Pavlica
binary' is expected. if u want the resultant 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" Sent: Wednesday, January

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 t

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 understands

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 UN

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 nap

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.

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: 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

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: 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" Sent: Monday, January 09, 2006 10:19 AM Subject: How can I keep character_set_client value after My

Re: Delete query problem

2005-12-21 Thread Dušan Pavlica
Dusan. - Original Message - From: "Tomas Rasek" <[EMAIL PROTECTED]> To: Sent: Wednesday, December 21, 2005 11:12 AM Subject: Re: Delete query problem What about DELETE master_tbl,detail_tbl FROM master_tbl LEFT JOIN detail_tbl ON master_tbl.ID=detail_tbl.ID WHERE . T.R.

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` int(

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, Mi

Re: Help with query

2005-10-12 Thread Dušan Pavlica
t want to write 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" Sent: Wednesday, October 12, 2

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 wit

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 qu

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 NAM

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 (

Re: Charset and LOAD DATA INFILE problem - solved

2005-04-11 Thread Dušan Pavlica
note about it in manual but I think it is useful to know it. Dusan - Original Message - From: "Dušan Pavlica" <[EMAIL PROTECTED]> To: "list mysql" Sent: Monday, April 11, 2005 10:52 AM Subject: Charset and LOAD DATA INFILE problem Hello, I'm trying to conve

Charset and LOAD DATA INFILE problem

2005-04-11 Thread Dušan Pavlica
Hello, I'm trying to convert tables from Paradox DBs to MySQL and I have a big problem with setting correct character set. I created small application which generates csv files which are in cp1250 (I can't change it, it's charset ofmy Paradox DBs). My databases and tables in MySQL are in latin2

Re: Index on boolean column

2005-03-31 Thread Dušan Pavlica
Martijn, - Original Message - From: "Martijn Tonies" <[EMAIL PROTECTED]> To: Sent: Thursday, March 31, 2005 10:46 AM Subject: Re: Index on boolean column > > >maybe this is a silly question but how useful it is to create > > >indexes on > >>columns containing only values 0 and 1 (true

Re: Index on boolean column

2005-03-30 Thread Dušan Pavlica
>maybe this is a silly question but how useful it is to create indexes on columns containing only values 0 and 1 (true and false)? Perhaps, instead of the index, you might revise your schema a bit. Why do you have this boolean column? What are you trying to achieve? I use boolean columns as a fla

Index on boolean column

2005-03-30 Thread Dušan Pavlica
Hello, maybe this is a silly question but how useful it is to create indexes on columns containing only values 0 and 1 (true and false)? TIA, Dusan

Problem with empty string comparison

2005-02-25 Thread Dušan Pavlica
Hello, I have upgraded MySQL from 4.0.7 to 4.1.9 (OS Win XP SP2) and now I have a problem with empty string comparison. Test case: CREATE TABLE tb_test ( t1 char(5) NOT NULL default '', t2 char(5) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_czech_cs; INSERT IN

Re: Change default character_set_client, connection, results

2005-02-24 Thread Dušan Pavlica
I finally found the solution. It's possible to set everything in MySQL ODBC/Connector on tab Connect options. I had to write to the field Initial Statement statement SET NAMES 'wanted_character_set' and that solved the problem. Dusan - Original Message - From: "Du

Re: Change default character_set_client, connection, results

2005-02-24 Thread Dušan Pavlica
Gleb, thanks for your response, but that doesn't help me much because I'm using ADO components to connect to MySQL and not MySQL API functions. Regards, Dusan Pavlica - Original Message - From: "Gleb Paharenko" <[EMAIL PROTECTED]> To: Sent: Wednesday, February 23, 2005 4:35 PM Subject:

Change default character_set_client, connection, results

2005-02-23 Thread Dušan Pavlica
Hello, could someone tell me if it is possible to change default settings for character_set_client, character_set_connection and character_set_results variables? They are always set to latin1 and I didn't find any way how to change their default value. I'm using MySQL 4.1.9-nt and MySQL ODBC 3.

Re: Undo function?

2005-01-21 Thread Dušan Pavlica
Hi, I want to add one more thing. Usually manually entered queries must end up with semicolon so if you hit enter before the end nothing happens. Regards, Dusan - Original Message - From: "shaun thornburgh" <[EMAIL PROTECTED]> To: Sent: Thursday, January 20, 2005 2:17 PM Subject: Undo f

Load data infile

2004-01-27 Thread Dušan Pavlica
Hi, I'm trying to figure out how to extract only some of the columns from text file. I know that I can use LOAD DATA INFILE but I didn't find the way how to use it to load data only from for example 1st, 3rd and 6th column. Could someone give me some tips, please? TIA Dusan Pavlica