Is there a GROUP function that can help me with this?

2008-08-22 Thread David Perron
Hi MySQL Users- I have a query problem I have been working on for quite some time and I am really at a loss to find a native function(s) to handle my task. I have this table: CREATE TABLE BookCategoryMetrics ( BookName VARCHAR(255), CategoryId VARCHAR(128), RatingSum DOUBLE, Cost DOUBLE,

GROUP ORDER BY Question

2008-05-21 Thread David Perron
Hello MySQL Users- I am pretty sure this is a simple question and I am over thinking how to solve the problem, so I am hoping the community can help. I am selecting a pretty straightforward aggregation from a single stats table with the following format: SELECT Description

TO_DAYS Date Range Question

2008-04-23 Thread David Perron
Hello Users- I think I have an interesting question with regards to applying a function to date range, I think half of problem solving is explaining it to an audience so please, bear with me. There is a table Orders that has two DATE columns, StartDate and EndDate. The range of dates can vary

Is there a way to load non-native Date type with LOAD DATA

2006-09-02 Thread David Perron
I have a pretty large file with a Date column in the format M/D/. Is there a way to either change the Date data type in the table or a method to indicate the date format in the LOAD DATA statement in order to handle this? Thanks in advance for any help! David -- MySQL General Mailing

Dynamic insertion of date for LOAD INFILE

2005-06-27 Thread David Perron
Im trying to get dynamically insert the current date into a LOAD FILE statement for some ETL automation, but Im having difficulty passing the string into the LOAD statement: This will not work. SELECT @Today:=CURDATE(); LOAD DATA LOCAL INFILE '/s3/data/[EMAIL PROTECTED]' INTO TABLE Data;

mysqldump: Error 2013

2004-09-29 Thread David Perron
Hello - Since recently switching from MyISAM to InnoDB tables in 4.1 on RH Linux I receive this error when attempting to dump some tables. mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `campaigns` at row: 14721 Any idea what could be causing this?

RE: need help with a query

2004-08-25 Thread David Perron
Are you assuming that all months have 30 days? You can use the same syntax with INTERVAL 1 MONTH I would also format the date comparison to use the same precision that the DATE_ADD function outputs. So, DATE_ADD(table.date, INTERVAL 1 MONTH) = DATE_FORMAT(CURDATE(), '%Y-%m-%d') I might be off

CSV Output

2004-08-12 Thread David Perron
Im looking for a way to output a file into true CSV format (with quoted fields) using the Perl DBI. Does anyone know of a way to do this (in either native MySQL or Perl)? Thanks as always! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Indicating an INDEX during TEMPORARY table creation

2004-08-11 Thread David Perron
When executing: CREATE TEMPORARY TABLE temp_1 AS SELECT * FROM table_name Is it possible to indicate an index within the syntax of this statement - as opposed to issuing an ALTER TABLE command after the table is created? Thanks in advance for any help. -- MySQL General Mailing List For

Using date ranges on a composite key degrades performance

2004-06-22 Thread David Perron
Im finding that when I execute a query joining to a large fact table (~450 million rows) using a composite key of INT(11) DATE for a single Date i.e. AND dimension.id = factable.id AND factable.Date = '2004-06-22' the query returns exceptionally fast. However, when I change this to a range,

RE: Using date ranges on a composite key degrades performance

2004-06-22 Thread David Perron
' -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 22, 2004 3:16 PM To: David Perron Cc: [EMAIL PROTECTED] Subject: Re: Using date ranges on a composite key degrades performance Are you using the JOIN ... ON... syntax or the comma syntax of joining

Select a Default column Value without a DESC?

2004-06-09 Thread David Perron
Does anyone know of a way to use a SELECT statement to get the default value for a column? A DESCRIBE tabl_name col_name gives the values, but I need it inside a SELECT. Thanks. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Trying to do a STRAIGHT JOIN to force an INDEX

2004-04-27 Thread David Perron
I have a query similar to the one below. Im trying to force a STRAIGHT JOING to Table5 which has an index on Id Date. For some reason, the optimizer isnt picking the INDEX to execute the query (and subsequently doing a full scan on a 250 million+ row table) so Im trying to force the STRAIGHT

User Conference Presentations

2004-04-21 Thread David Perron
Does anyone know if the presentations from the User Conference are available online? Thanks dp

Querying a tmp table

2004-03-29 Thread David Perron
Is it possible to query a tmp table that mysql creates automatically when dealing with large queries? When I do a 'show processlist' and it gives a state of 'Copying to tmp table' , is there a way to query or access this tmp table to see the status of the query? Im thinking this would give me an

Nested IF statement in 3.23.57

2004-03-25 Thread David Perron
Are nested IF statements valid? Doesn't say anything here: http://www.mysql.com/doc/en/Control_flow_functions.html Trying to get a conditional count using the following statement - but Im receiving an error. I would use a CASE statement but my version doesn't support it.

RE: Preventing Duplicate Entries

2004-03-22 Thread David Perron
Is it possible to use a primary key to avoid duplicates? The reaction to duplicate rows will depend on what type of statement you are issuing. An update/delete would update/delete all rows that are relevant, a select would return multiple rows with the same values. -Original Message-

ROWNUM in mysql

2004-03-16 Thread David Perron
How can I select a mysql version of the Oracle 'rownum' inside a SQL statement? I need to include this for a ranking type functionality - but I don't see this type of analytic functionality. Any help would be appreciated. David

RE: Query Problems

2004-02-25 Thread David Perron
What does the explain look like? -Original Message- From: Eric Scuccimarra [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 1:03 PM To: [EMAIL PROTECTED] Subject: Query Problems I am doing a very simple query joining two copies of tables with identical structures but

Changing default delimiter

2004-02-23 Thread David Perron
Greetings - Been scouring the docs for this all day and I come up with nothing for 'delimiter' - Id like to change the default delimiter in mysql to something other than tab. Is there a command to do this, and what are the options? Thank you! David

RE: Changing default delimiter

2004-02-23 Thread David Perron
with different characters: http://www.mysql.com/doc/en/LOAD_DATA.html On Mon, 2004-02-23 at 13:53, David Perron wrote: Greetings - Been scouring the docs for this all day and I come up with nothing for 'delimiter' - Id like to change the default delimiter in mysql to something other than tab

Default UTF-8 Encoding

2004-02-13 Thread David Perron
Hello- Is there a way to change the default mysql encoding to be something else, say UTF-16LE at the session level? As always, thanks! __ David Perron Sales Professional Services Consultant P: 212-624-9600 ext. 221 C: 917-678-2081

RE: Autocolumn and pk

2004-02-10 Thread David Perron
You would use a concept called auto-increment, and you can create it when you create your tables: CREATE TABLE animals ( id MEDIUMINT NOT NULL AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY (id) ); More information here:

LEFT JOIN to a table using 2 keys from different tables

2004-02-09 Thread David Perron
Is there a way to do this? Im trying to LEFT JOIN to a table that needs to select based on 2 keys, but the query Im writing only has the keys individually in two separate tables, like this. The documentation shows how to do this when you are using 2 keys from both tables, but not 1 key from 1

Erwin from sql script

2004-02-06 Thread David Perron
I have a sql file that I would like to convert to an ER diagram - any suggestions on a tool (free if possible) that would help me do this? Thanks for your suggestions.

Lower_case_tables_names variable

2004-02-06 Thread David Perron
Iom trying to figure out to use mysqld and set this varible so that when I execute sql scripts, the case is considered. Running this version of mysql in Windows XP Pro. mysql select version(); ++ | version() | ++ |

SUBSTRING on a LONGBLOB

2004-01-29 Thread David Perron
Im trying to retreive the data from a LONGBLOB column but I have been unable to convert the binary data back to character data. Is there something Im not doing right with the query below? SELECT changehistory.timestamp, SUBSTRING(changedata.changes,1,1000) FROM changehistory, JOIN changedata ON

RE: if statement

2004-01-29 Thread David Perron
You could use a CASE statement: SELECT CASE WHEN @exp = 5 AND @exp = 10 THEN vacation + 4 WHEN @exp 2 AND @exp 5 THEN vacation + 2 ELSE vacation END -Original Message- From: sakhiya [mailto:[EMAIL PROTECTED] Sent: Thursday,

Trying to change the root pwd

2004-01-28 Thread David Perron
Hello - Im trying to change the root password on a new mysql installation. Im running 4.1.1a-alpha on WindowsXP with Apache running. I get the error below saynig access denied. How do I get into the user table as root if It wont allow me into the database? Any help would be appreciated.

RE: Trying to change the root pwd

2004-01-28 Thread David Perron
| | tables_priv | | user| +-+ 6 rows in set (0.00 sec) -Original Message- From: Brian Harris [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 2:51 PM To: David Perron Cc: [EMAIL PROTECTED] Subject: Re: Trying to change the root pwd Hey David I'm

LONGBLOB datatype conversion to text

2004-01-28 Thread David Perron
Does anyone know of a function to employ when retrieving a LONGBLOB column - Im creating an ad hoc query and would like to see the data in text format.

Export Database Structure sans data

2004-01-26 Thread David Perron
Im looknig for the function that will allow me to export the database structure into a static file, without the actual data. I would like to create an ERD diagram with the output file. David