Plz Help!!! SELECT not working with Å Æ Ø Ä Ö Characters

2007-08-11 Thread VeeJay
*From: VeeJay* [EMAIL PROTECTED] To: mysql@lists.mysql.com, [EMAIL PROTECTED] Date: Fri, Aug 10, 2007 at 8:19 AM Hello there I have a problem. When I try to select some names starting with extra alphabets (Å Æ Ø Ä Ö, etc), I simply don't get required results i.e., if I give a select command

Plz Help!!! SELECT not working with Å Æ Ø Ä Ö Characters

2007-08-10 Thread VeeJay
Hello there I have a problem. When I try to select some names starting with extra alphabets (Å Æ Ø Ä Ö, etc), I simply don't get required results i.e., if I give a select command like: select * from employees where fname LIKE 'Å%'; I get results starting with English alphabet 'A' but not with 'Å

Re: Plz Help!!! SELECT not working with Å Æ Ø Ä Ö Characters

2007-08-10 Thread mysql
in addition to the correct character-set also set the appropriate collation sequence suomi VeeJay wrote: Hello there I have a problem. When I try to select some names starting with extra alphabets (Å Æ Ø Ä Ö, etc), I simply don't get required results i.e., if I give a select command like

Re: remove temporary table from SELECT query

2007-08-10 Thread Mike Zupan
buffer size or eliminating more rows from the query. -Original Message- From: Mike Zupan [mailto:[EMAIL PROTECTED] Sent: Friday, 10 August 2007 4:52 AM To: mysql@lists.mysql.com Subject: remove temporary table from SELECT query I have been pulling my hair out over a temporary table

Insert Select query problem

2007-08-10 Thread Ed Reed
Into `request` (Required, Qty) Values ('Apples', 12), ('Bananas', 112), ('Cherries', 5); Now what I*d like to do is create a single Insert Select query that creates a record in my purchase table for each of the items in my request table based on the number of items available in my inventory

Re: Insert Select query problem

2007-08-10 Thread Jay Pipes
), ('Cherries',6); Insert Into `request` (Required, Qty) Values ('Apples', 12), ('Bananas', 112), ('Cherries', 5); Now what I*d like to do is create a single Insert Select query that creates a record in my purchase table for each of the items in my request table based on the number of items available

Re: remove temporary table from SELECT query

2007-08-10 Thread Ananda Kumar
temporary table from SELECT query I have been pulling my hair out over a temporary table being created in the following query SELECT SQL_NO_CACHE SQL_CALC_FOUND_ROWS entryid,title FROM friends_test INNER JOIN entries ON friendLink=userid AND userLink=2 order

Re: remove temporary table from SELECT query

2007-08-10 Thread Ananda Kumar
: Friday, 10 August 2007 4:52 AM To: mysql@lists.mysql.com Subject: remove temporary table from SELECT query I have been pulling my hair out over a temporary table being created in the following query SELECT SQL_NO_CACHE SQL_CALC_FOUND_ROWS entryid,title FROM friends_test INNER JOIN

Re: remove temporary table from SELECT query

2007-08-10 Thread Ananda Kumar
temporary table from SELECT query I have been pulling my hair out over a temporary table being created in the following query SELECT SQL_NO_CACHE SQL_CALC_FOUND_ROWS entryid,title FROM friends_test INNER JOIN entries ON friendLink=userid AND userLink=2 order by entryid

Re: remove temporary table from SELECT query

2007-08-10 Thread Mike Zupan
buffer size or eliminating more rows from the query. -Original Message- From: Mike Zupan [mailto: [EMAIL PROTECTED] ] Sent: Friday, 10 August 2007 4:52 AM To: mysql@lists.mysql.com Subject: remove temporary table from SELECT query I have been pulling my

Re: Insert Select query problem

2007-08-10 Thread Ed Reed
) SELECT 1, totals.Item,if((totals.TotQty -r.Qty)0,r.qty, totals.TotQty) FROM request r JOIN (SELECT Item, SUM(Qty) AS TotQty FROM inventory GROUP BY Item) AS totals ON r.Required = totals.Item UNION All SELECT 0, totals.Item, (r.Qty - totals.TotQty) FROM request r JOIN

remove temporary table from SELECT query

2007-08-09 Thread Mike Zupan
I have been pulling my hair out over a temporary table being created in the following query SELECT SQL_NO_CACHE SQL_CALC_FOUND_ROWS entryid,title FROM friends_test INNER JOIN entries ON friendLink=userid AND userLink=2 order by entryid if I change userLink=2 to friendLink=2 it is fine and its

RE: remove temporary table from SELECT query

2007-08-09 Thread Andrew Armstrong
[mailto:[EMAIL PROTECTED] Sent: Friday, 10 August 2007 4:52 AM To: mysql@lists.mysql.com Subject: remove temporary table from SELECT query I have been pulling my hair out over a temporary table being created in the following query SELECT SQL_NO_CACHE SQL_CALC_FOUND_ROWS entryid,title FROM

Select problem

2007-07-19 Thread richard
I am having a problem with SELECT. The table has 3 rows. I am using the C api. Here is my C code. count = mysql_query(my_db, SELECT * FROM accounts); er = mysql_error(my_db); res = mysql_use_result(my_db); num_row = mysql_num_rows(res); count is returned as 0 (no error) er

SELECT missing records

2007-07-12 Thread Jerry Schwartz
with price.prod_curr = GBP or some other currency, so a product might 1, 2, 3, or more prices. I believe this query will do it, but can it be redone without the sub-query by using JOINs? Would that be more efficient? SELECT prod.prod_num, price.prod_price FROM prod JOIN price WHERE prod.prod_id = price.prod_id

Re: SELECT missing records

2007-07-12 Thread Ananda Kumar
Try this SELECT prod.prod_num, price.prod_price FROM prod JOIN price WHERE prod.prod_id = price.prod_id AND price.prod_curr !='YEN'; On 7/12/07, Jerry Schwartz [EMAIL PROTECTED] wrote: I've been banging my head against the walls for hours, so I hope somebody can help. I know similar

Re: SELECT missing records

2007-07-12 Thread Perrin Harkins
On 7/12/07, Jerry Schwartz [EMAIL PROTECTED] wrote: I believe this query will do it, but can it be redone without the sub-query by using JOINs? Yes, use a LEFT JOIN. Would that be more efficient? Yes. SELECT prod.prod_num, price.prod_price FROM prod JOIN price WHERE prod.prod_id

RE: SELECT missing records

2007-07-12 Thread Jerry Schwartz
To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: SELECT missing records Try this SELECT prod.prod_num, price.prod_price FROM prod JOIN price WHERE prod.prod_id = price.prod_id AND price.prod_curr !='YEN'; On 7/12/07, Jerry Schwartz [EMAIL PROTECTED] wrote: I've been banging my head

RE: SELECT missing records

2007-07-12 Thread Jerry Schwartz
I never thought of putting an additional condition on the LEFT JOIN. That seems to do the trick. My original query, with the sub-SELECT, does work. Both your technique and mine generate identical results. I did an EXPLAIN on each technique, but I don't know enough to interpret it. Since

RE: SELECT missing records

2007-07-12 Thread Jerry Schwartz
My apologies, you were correct: I left out a line from my query, so it would have given bogus results except for the fortunate fact that every product having at least one price has a USD price. The EXPLAIN output didn't change. Regards, Jerry Schwartz The Infoshop by Global Information

Re: SELECT missing records

2007-07-12 Thread Perrin Harkins
On 7/12/07, Jerry Schwartz [EMAIL PROTECTED] wrote: Since the rows is identical except for the last bit, where mine is 4 and yours is 2, does that mean yours is roughly more efficient by a 2:1 ratio? For the most part, MySQL will do better with LEFT JOIN than an IN subquery. You can read all

Re: SELECT missing records

2007-07-12 Thread Perrin Harkins
On 7/12/07, Jerry Schwartz [EMAIL PROTECTED] wrote: I think that will give me one record for every price that is not Yen, so if a product has a price in USD and a price in GBP it will show up twice. That would happen if you removed the 'USD' condition from the first JOIN. Like I said, I'm not

Re: SELECT missing records

2007-07-12 Thread mos
At 07:26 PM 7/12/2007, Perrin Harkins wrote: On 7/12/07, Jerry Schwartz [EMAIL PROTECTED] wrote: Since the rows is identical except for the last bit, where mine is 4 and yours is 2, does that mean yours is roughly more efficient by a 2:1 ratio? For the most part, MySQL will do better with

Re: SELECT missing records

2007-07-12 Thread Perrin Harkins
On 7/12/07, mos [EMAIL PROTECTED] wrote: BTW, joins will work faster if you load one or more tables in a Memory table before you do the join. Well, if your tables are so small that you can load them entirely into memory, it probably doesn't matter how you code the query. - Perrin -- MySQL

Select Last X rows

2007-06-30 Thread Rich
Hi folks. Just wanting to know the best way to grab the last 10 rows from a table. Looking twice to the db to see how many records there are will be outdated by the time the SELECT is done, so it's moot. This is a fast moving db with records coming and going. Instead of having

Re: Select Last X rows

2007-06-30 Thread Borokov Smith
Rich schreef: Hi folks. Just wanting to know the best way to grab the last 10 rows from a table. Looking twice to the db to see how many records there are will be outdated by the time the SELECT is done, so it's moot. This is a fast moving db with records coming and going. Instead

Re: Select Last X rows

2007-06-30 Thread Octavian Rasnita
Hi, Try something like this: select * from (select * from table_name where ... order by last_update desc limit 10) as tbl order by tbl.last_update; Octavian - Original Message - From: Rich [EMAIL PROTECTED] To: Submit MySQL mysql@lists.mysql.com Sent: Saturday, June 30, 2007 3:45

Re: Select Last X rows

2007-06-30 Thread Rich
On Jun 30, 2007, at 9:06 AM, Borokov Smith wrote: Hey, Why is ORDER BY in combination with LIMIT not a valid solution to your problem ? Greetz, Hi there. Because if I choose ASC it chooses the first X records, and if I choose DESC it chooses the last X records, but in reverse

Re: Select Last X rows

2007-06-30 Thread Rich
Ah that makes sense. It's a double shot, first grabbing the necessary records, then selecting all in that temp value (hitlist) in reverse order. Well done. Cheers On Jun 30, 2007, at 11:26 AM, Octavian Rasnita wrote: Hi, Try something like this: select * from (select * from table_name

Re: Select Last X rows

2007-06-30 Thread Andrew Hutchings
Rich wrote: Ah that makes sense. It's a double shot, first grabbing the necessary records, then selecting all in that temp value (hitlist) in reverse order. Well done. Cheers On Jun 30, 2007, at 11:26 AM, Octavian Rasnita wrote: Hi, Try something like this: select * from (select * from

RE: select statement with variable for table_reference?

2007-06-28 Thread Price, Randall
; CREATE TABLE `myrecords` ( `record_id` int(11) NOT NULL auto_increment, `table_id` int(11) NOT NULL, `record_id_in_table` int(11) NOT NULL, PRIMARY KEY (`record_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | == TEST DATA == mysql select * from mydatabases

Re: select statement with variable for table_reference?

2007-06-27 Thread Octavian Rasnita
in the (select ... where ...) and if you want to specify a search criteria for all the records of those unions, you can do it in a final where ... that's outside of those params. Octavian - Original Message - From: Ed Lazor [EMAIL PROTECTED] To: 'Octavian Rasnita' [EMAIL PROTECTED]; mysql

RE: select statement with variable for table_reference?

2007-06-27 Thread Price, Randall
table(s) to search, something like this: SET @strOtherTable = (SELECT other_table_name FROM first_table WHERE ...); SET @strSQL = CONCAT(SELECT ... FROM , @strOtherTable, WHERE...); ... ... PREPARE Statement FROM @strSQL; EXECUTE Statement; DEALLOCATE PREPARE Statement; I guess what

RE: select statement with variable for table_reference?

2007-06-27 Thread Ed Lazor
@strOtherTable = (SELECT other_table_name FROM first_table WHERE ...); SET @strSQL = CONCAT(SELECT ... FROM , @strOtherTable, WHERE...); The first thing I automatically think of is that the first select will very likely have more than one record in the result set. Is there a way to loop through

Re: select statement with variable for table_reference?

2007-06-27 Thread Octavian Rasnita
= ; for(books, cds) { $sql .= join union , (select id, title, from $_); } $sql .= where ... order by ... limit ...; So the sql query will search only in the needed tables. Octavian - Original Message - From: Ed Lazor [EMAIL PROTECTED] To: 'Octavian Rasnita' [EMAIL PROTECTED]; [EMAIL

select statement with variable for table_reference?

2007-06-26 Thread Ed Lazor
Is there a way to get something like this to work? Set @tname=mytable; Select * from @tname; Here's what I'm trying to really accomplish in case there is yet another way to approach this... I have to work with product data from multiple databases and multiple tables. For example, one database

Re: select statement with variable for table_reference?

2007-06-26 Thread Octavian Rasnita
I am using the following method for doing this, but I am sure it is not the best one: (select id, title, author, 'book' as type from books) union (select id, title, author, 'cd' as type from cds) union (select id, title, author, 'dvd' as type from dvds) where ... order by ... limit

RE: select statement with variable for table_reference?

2007-06-26 Thread Ed Lazor
Ok, I used your approach like this: -- select i.scanned_barcode, v.title from inventory as i left join version as v on i.record_id = v.id where i.database_id = '1' AND i.table_id = '1' AND i.user_id = '33' and category_id = '766') UNION

RE: select statement with variable for table_reference?

2007-06-26 Thread Jerry Schwartz
Getting back to your original question, I don't know of any way you can use a variable as a table name directly. You can, however, pull off something like this: mysql set @table = stage; Query OK, 0 rows affected (0.06 sec) mysql set @stmt = CONCAT(SELECT * FROM , @table); /* Arbitrarily complex

RE: select statement with variable for table_reference?

2007-06-26 Thread Price, Randall
What about using PREPARED STATEMENTS in a stored procedure? Something like: CREATE PROCEDURE `GetInventory`( IN strTableName VARCHAR(50), ...) BEGIN SET @strSQL = CONCAT(SELECT * FROM , strTableName); ... ... PREPARE Statement FROM @strSQL; EXECUTE

RE: select statement with variable for table_reference?

2007-06-26 Thread Ed Lazor
Thanks for the info Jerry. =) -Original Message- From: Jerry Schwartz [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 26, 2007 1:59 PM To: 'Ed Lazor'; 'Octavian Rasnita'; mysql@lists.mysql.com Subject: RE: select statement with variable for table_reference? Getting back to your

RE: select statement with variable for table_reference?

2007-06-26 Thread Ed Lazor
VARCHAR(50), ...) BEGIN SET @strSQL = CONCAT(SELECT * FROM , strTableName); ... ... PREPARE Statement FROM @strSQL; EXECUTE Statement; DEALLOCATE PREPARE Statement; END Of course, you can build any type of statement to execute using this technique. One

last insert ids from insert select

2007-06-22 Thread Ezequiel Panepucci
statement which I currently cursor.execute: num_lines = cursor.execute(insert into AAA (name,desc) select name,desc from BBB) The primary key in AAA is an auto_increment `id`. The return is the number of lines which were inserted and cursor.lastrowid (LAST_INSERT_ID()) evaluates to the *first* `id

Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-14 Thread KLEIN Stéphane
2007/6/13, Ricardas S [EMAIL PROTECTED]: ops again you probably needed just select greatest(col1,col2,col3) from t order by 1 Thanks, it's work very well. best regards -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com

How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread KLEIN Stéphane
Hi, I would like do something like : SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); I know this syntax is wrong but I would like get a solution to this stuff. Thanks for your help. Stephane -- MySQL General Mailing List For list archives: http://lists.mysql.com

Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread Ricardas S
Have you tried MAX((col1*(MAX_VALUE_OF_COL1+1)+col2)*(MAX_VALUE_OF_COL2+1)+col3) - Original Message - From: KLEIN Stéphane [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, June 13, 2007 09:30 Subject: How can I do something like this SELECT MAX(col1, col2, col3) FROM

Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread Ricardas S
Ops, small mistake, shoud be MAX((col1*(MAX_VALUE_OF_COL2+1)+col2)*(MAX_VALUE_OF_COL3+1)+col3) - Original Message - From: Ricardas S [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, June 13, 2007 09:36 Subject: Re: How can I do something like this SELECT MAX(col1, col2

Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread KLEIN Stéphane
2007/6/13, Ricardas S [EMAIL PROTECTED]: Ops, small mistake, shoud be MAX((col1*(MAX_VALUE_OF_COL2+1)+col2)*(MAX_VALUE_OF_COL3+1)+col3) Sorry, my question is ashamed. Example, I've this row : Col1 | Col2 | Col3 1 | 5 | 8 6 | 2 | 4 12| 13 | 6 After my query,

Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread Ricardas S
select greatest(col1,col2,col3) from (select max(col1) as col1 from t) a, (select max(col2) as col2 from t) b, (select max(col3) as col3 from t) c - Original Message - From: KLEIN Stéphane [EMAIL PROTECTED] To: Ricardas S [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Sent: Wednesday

Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread Ricardas S
ops again you probably needed just select greatest(col1,col2,col3) from t order by 1 - Original Message - From: Ricardas S [EMAIL PROTECTED] To: KLEIN Stéphane [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Sent: Wednesday, June 13, 2007 11:02 Subject: Re: How can I do something like

Select and COUNT

2007-06-08 Thread spacemarc
Hi all, I have this query: SELECT tableA.*, COUNT(*) AS Tot FROM tableB LEFT JOIN tableA ON tableA.uid=tableB.uid GROUP BY tableA.uid This query shows only the users (tableA) that are in tableB with at least 1 record (like total) but not the users that have 0 record. How can I obtain all users

only select privilege

2007-06-08 Thread Ananda Kumar
How do i give only select privilege to a specific database. I did this GRANT SELECT ON abc.* to 'ab'@'%' identified by 'ab'; FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql select select_priv from user where user='qa'; +-+ | select_priv | +-+ | N

Re: only select privilege

2007-06-08 Thread Jon Ribbens
On Fri, Jun 08, 2007 at 03:14:18PM +0530, Ananda Kumar wrote: How do i give only select privilege to a specific database. GRANT SELECT ON abc.* to 'ab'@'%' identified by 'ab'; Like that. mysql select select_priv from user where user='qa'; +-+ | select_priv

Re: only select privilege

2007-06-08 Thread Ananda Kumar
Hi Jon, So, what ever i did is right? please let me know. regards anandkl On 6/8/07, Jon Ribbens [EMAIL PROTECTED] wrote: On Fri, Jun 08, 2007 at 03:14:18PM +0530, Ananda Kumar wrote: How do i give only select privilege to a specific database. GRANT SELECT ON abc.* to 'ab'@'%' identified

Re: only select privilege

2007-06-08 Thread Juan Eduardo Moreno
Hi, Try to do that : GRANT SELECT ON abc.* to 'qa'@'%' identified by 'qa'; flush privileges; Explain : The user qa have access of all tables of user abc. In this command, only SELECT is possible is you connect using user qa. Regards, Juan On 6/8/07, Ananda Kumar [EMAIL PROTECTED] wrote

Re: only select privilege

2007-06-08 Thread Ananda Kumar
Hi Juan, Do you me all table in database abc. Please confirm. Is it a typo or something else. regards anandkl On 6/8/07, Juan Eduardo Moreno [EMAIL PROTECTED] wrote: Hi, Try to do that : GRANT SELECT ON abc.* to 'qa'@'%' identified by 'qa'; flush privileges; Explain : The user qa have

Re: only select privilege

2007-06-08 Thread Ananda Kumar
Thanks Jon. regards anandkl On 6/8/07, Jon Ribbens [EMAIL PROTECTED] wrote: On Fri, Jun 08, 2007 at 04:25:00PM +0530, Ananda Kumar wrote: So, what ever i did is right? Yes. User 'ab' can SELECT on all tables in database 'abc'. -- MySQL General Mailing List For list archives: http

Re: only select privilege

2007-06-08 Thread Jon Ribbens
On Fri, Jun 08, 2007 at 04:25:00PM +0530, Ananda Kumar wrote: So, what ever i did is right? Yes. User 'ab' can SELECT on all tables in database 'abc'. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Select and COUNT

2007-06-08 Thread Baron Schwartz
Hi spacemarc, spacemarc wrote: Hi all, I have this query: SELECT tableA.*, COUNT(*) AS Tot FROM tableB LEFT JOIN tableA ON tableA.uid=tableB.uid GROUP BY tableA.uid This query shows only the users (tableA) that are in tableB with at least 1 record (like total) but not the users that have 0

Re: Select and COUNT

2007-06-08 Thread Baron Schwartz
-in-mysql/ I've inverted, like you said, the tables and used LEFT OUTER JOIN: SELECT tableA. * , COUNT( tableB.uid ) AS Tot FROM tableA LEFT OUTER JOIN tableB ON tableB.uid = tableA.uid GROUP BY tableA.uid and it works. I also tried this other: SELECT tableA.*, COUNT(tableB.uid) AS Tot FROM

RE: Select and COUNT

2007-06-08 Thread Jerry Schwartz
SELECT tableA.*, COUNT(*) AS Tot FROM tableB LEFT OUTER JOIN tableA ON tableA.uid=tableB.uid GROUP BY tableA.uid Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com

error while doing a select

2007-06-01 Thread Ananda Kumar
Hi All, We are using mysql version 5.0.40. We took a snapshot of the our database, and copied over the snapshot to anther machine and start mysql on the new snapshot. Its innodb engine when i treid to select from one of the tables i am getting this error, how do i fix this ,please help select

Re: error while doing a select

2007-06-01 Thread Baron Schwartz
Hi, Ananda Kumar wrote: Hi All, We are using mysql version 5.0.40. We took a snapshot of the our database, and copied over the snapshot to anther machine and start mysql on the new snapshot. Its innodb engine when i treid to select from one of the tables i am getting this error, how do i fix

select with like not working...

2007-05-25 Thread Jason Pruim
Hi all, I'm new to the list so please excuse me if I make some newbie mistakes, I am having trouble figuring out why a select statement won't work, Here's the statement: SELECT 'FName' FROM `current` WHERE `FName` like '%jason%';. if I run select 'FName' FROM current; then I get 6 rows

Re: select with like not working...

2007-05-25 Thread Mike Lockhart
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Have you tried using 'jason%' instead of '%jason%'? Also, do you have an index on that column? Jason Pruim wrote: Hi all, I'm new to the list so please excuse me if I make some newbie mistakes, I am having trouble figuring out why a select

Re: select with like not working...

2007-05-25 Thread Jason Pruim
: SHA1 Have you tried using 'jason%' instead of '%jason%'? Also, do you have an index on that column? Jason Pruim wrote: Hi all, I'm new to the list so please excuse me if I make some newbie mistakes, I am having trouble figuring out why a select statement won't work, Here's the statement

Re: select with like not working...

2007-05-25 Thread Ricardo Conrado Serafim
newbie mistakes, I am having trouble figuring out why a select statement won't work, Here's the statement: SELECT 'FName' FROM `current` WHERE `FName` like '%jason%';. if I run select 'FName' FROM current; then I get 6 rows that say 'jason'. but nothing is showing up when I use 'like'. Any ideas

Select question

2007-05-17 Thread Erich C. Beyrent
I have three tables, all of which have a 'name' column. If I do: select table1.*, table2.*, table3.* from I'll end up with a result set that has three 'name' fields, but no way to distinguish which table the field belongs to. I know I can select individual columns like: select table1

Re: Select question

2007-05-17 Thread Peter Brawley
of which have a 'name' column. If I do: select table1.*, table2.*, table3.* from I'll end up with a result set that has three 'name' fields, but no way to distinguish which table the field belongs to. I know I can select individual columns like: select table1.name as foo, table2.name

SELECT statement returning columns for a given table?

2007-05-13 Thread Kelly Jones
In PostgreSQL, the following SELECT statement will return all the columns for 'tabname': SELECT x.attname FROM pg_attribute x, pg_class y WHERE x.attrelid=y.oid AND relname='tabname'; Does MySQL have anything similar? I know about SHOW COLUMNS FROM tabname, but am looking for something more

Re: SELECT statement returning columns for a given table?

2007-05-13 Thread Baron Schwartz
Hi Kelly, Kelly Jones wrote: In PostgreSQL, the following SELECT statement will return all the columns for 'tabname': SELECT x.attname FROM pg_attribute x, pg_class y WHERE x.attrelid=y.oid AND relname='tabname'; Does MySQL have anything similar? I know about SHOW COLUMNS FROM tabname

Re: SELECT statement returning columns for a given table?

2007-05-13 Thread Peter Brawley
this info, but it doesn't seem to. In 5.0 later MySQL implements the ISO SQL spec for information_schema, which does that. PB - Kelly Jones wrote: In PostgreSQL, the following SELECT statement will return all the columns for 'tabname': SELECT x.attname FROM pg_attribute x, pg_class y

View select results

2007-05-02 Thread spacemarc
Hi my table have three fields that, if selected, are shown like: area1, value_one, thing_one area1, value_two, thing_32 area1, value_three, thing_ dd area2, value_ten, thing_6w area2, value_ff, thing_l can I obtain a recordset like this? area1, value_one, thing_one //, value_two,

Re: View select results

2007-05-02 Thread Baron Schwartz
Hi, spacemarc wrote: Hi my table have three fields that, if selected, are shown like: area1, value_one, thing_one area1, value_two, thing_32 area1, value_three, thing_ dd area2, value_ten, thing_6w area2, value_ff, thing_l can I obtain a recordset like this? area1, value_one,

Re: View select results

2007-05-02 Thread Peter Brawley
can I obtain a recordset like this? area1, value_one, thing_one //, value_two, thing_32 //, value_three, thing_ dd area2, value_ten, thing_6w //, value_ff, thing_l SET @prev=''; SELECT IF(area = @prev, '', @prev := area) AS area, ... other columns ... FROM c ... PB spacemarc

Re: View select results

2007-05-02 Thread spacemarc
2007/5/2, Peter Brawley [EMAIL PROTECTED]: Works for me. Please post a CREATE TABLE stmt enough INSERTs to demonstrate the problem. This is the dump (MySQL: 5.0.38): the table is not final version, just to test the query. CREATE TABLE `products` ( `area` varchar(25) NOT NULL, `text`

Re: View select results

2007-05-02 Thread Peter Brawley
Right, give the computed column an alias differeing from the column name, eg SET @prev=''; SELECT IF(area = @prev, '', @prev := area) AS AreaHdr, text,amount FROM products ORDER BY area DESC; PB spacemarc wrote: 2007/5/2, Peter Brawley [EMAIL PROTECTED]: Works for me. Please post

Re: View select results

2007-05-02 Thread spacemarc
2007/5/2, Peter Brawley [EMAIL PROTECTED]: Right, give the computed column an alias differeing from the column name, eg SET @prev=''; SELECT IF(area = @prev, '', @prev := area) AS AreaHdr, text,amount FROM products ORDER BY area DESC; ok, now it works! thanks! One last thing: you set

Re: View select results

2007-05-02 Thread Peter Brawley
SET @prev=''; SELECT IF(area = @prev, '', @prev := area) AS AreaHdr, text,amount FROM products ORDER BY area DESC; ok, now it works! thanks! One last thing: you set, at first, a parameter called @prev with Null (' ') value: right? And, after, you use, instead IF ELSE statement, another

RE: select first letters

2007-04-26 Thread Jerry Schwartz
: Wednesday, April 25, 2007 12:15 PM To: Jerry Schwartz; mysql@lists.mysql.com Subject: Re: select first letters Finaly I use ord(). Thank you. Jerry Schwartz wrote: The multi-byte extension doesn't seem to include one, but it appears that somebody put one together and posted

select first letters

2007-04-25 Thread nikos
Hello list. I want to select discinct the first letters of titles in a UTF8 table but only the greek ones. There are both english and greek charakter titles. How can I exclude the english from selection? My table is: CREATE TABLE `odigos_details` ( `id` int(11) NOT NULL auto_increment, `cat

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: select first letters

2007-04-25 Thread Jerry Schwartz
[mailto:[EMAIL PROTECTED] Sent: Wednesday, April 25, 2007 9:28 AM To: mysql@lists.mysql.com Subject: select first letters Hello list. I want to select discinct the first letters of titles in a UTF8 table but only the greek ones. There are both english and greek charakter titles. How can I

Re: select first letters

2007-04-25 Thread nikos
Seems that work in v. 4.1.21 but not in 5.0.27 Thank you Dusan Dus(an Pavlica wrote: 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

Re: select first letters

2007-04-25 Thread nikos
. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: nikos [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 25, 2007 9:28 AM To: mysql@lists.mysql.com Subject: select first letters Hello list. I want to select discinct the first letters of titles in a UTF8

RE: select first letters

2007-04-25 Thread Jerry Schwartz
:07 AM To: Dus(an Pavlica; mysql@lists.mysql.com Subject: Re: select first letters Seems that work in v. 4.1.21 but not in 5.0.27 Thank you Dusan Dus(an Pavlica wrote: I'm not sure, but I think that greek characters are sorted after English chars so try this: SELECT DISTINCT LEFT

Re: select first letters

2007-04-25 Thread nikos
; mysql@lists.mysql.com Subject: Re: select first letters Seems that work in v. 4.1.21 but not in 5.0.27 Thank you Dusan Dus(an Pavlica wrote: 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

RE: select first letters

2007-04-25 Thread Jerry Schwartz
860.674.8796 / FAX: 860.674.8341 _ From: nikos [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 25, 2007 11:41 AM To: Jerry Schwartz; mysql@lists.mysql.com Subject: Re: select first letters Jerry do you know if there is a php command that returns ascci number of a letter? I'll want

Re: select first letters

2007-04-25 Thread nikos
@lists.mysql.com *Subject:* Re: select first letters Jerry do you know if there is a php command that returns ascci number of a letter? I'll want to use chr() command because I want to transfer via link the letter to next page but greek characters transformed to something like %CE%9C

Help please: SELECT in binlog?

2007-04-19 Thread Fionn Behrens
any SELECT statement from the log!? The usual search engine run didnt bring up anything useful, so my questions are: 1) Are the selects somwhere in the binlogs and I just have not found the right voodoo to make the come out? 2) If they are not there by default, can I configure mysqld to store

Re: Help please: SELECT in binlog?

2007-04-19 Thread Jay Pipes
and I could not get any SELECT statement from the log!? The usual search engine run didnt bring up anything useful, so my questions are: 1) Are the selects somwhere in the binlogs and I just have not found the right voodoo to make the come out? No, no selects. Only commands that change data

Re: Help please: SELECT in binlog?

2007-04-19 Thread Fionn Behrens
logs should be clearly mentioned somewhere in the docs. Especially the mysqlbinlog manpage might be a good place to mention that SELECT statements can not be restored with it. kind regards, Fionn -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql

Re: Help please: SELECT in binlog?

2007-04-19 Thread David Precious
different from normal text logs should be clearly mentioned somewhere in the docs. Especially the mysqlbinlog manpage might be a good place to mention that SELECT statements can not be restored with it. I think it's already fairly clearly stated that the binlog is only for replaying queries which would

Re: How to overwrite existing file with SELECT .. INTO?

2007-04-17 Thread Atle Veka
There is no option to do this to my knowledge. However, this would be a quick workaround: - TRUNCATE TABLE table; # clears table completely, akin to doing DROP/CREATE TABLE - INSERT INTO table SELECT .. FROM ..; On Mon, 16 Apr 2007, Amer Neely wrote: At 08:14 AM 4/13/2007, Amer Neely wrote

Re: How to overwrite existing file with SELECT .. INTO?

2007-04-17 Thread Amer Neely
Atle Veka wrote: There is no option to do this to my knowledge. However, this would be a quick workaround: - TRUNCATE TABLE table; # clears table completely, akin to doing DROP/CREATE TABLE - INSERT INTO table SELECT .. FROM ..; Again, you missed the critical part. I'm trying to replace

Re: How to overwrite existing file with SELECT .. INTO?

2007-04-17 Thread Paul DuBois
At 10:14 AM -0400 4/13/07, Amer Neely wrote: I'm using MySQL 5.0.21 and am trying to find out if it is possible to overwrite an existing file when using a 'SELECT ... INTO' command from the command line. Is there another parameter that can do this? I've looked through the online reference

Re: How to overwrite existing file with SELECT .. INTO?

2007-04-17 Thread Amer Neely
Paul DuBois wrote: At 10:14 AM -0400 4/13/07, Amer Neely wrote: I'm using MySQL 5.0.21 and am trying to find out if it is possible to overwrite an existing file when using a 'SELECT ... INTO' command from the command line. Is there another parameter that can do this? I've looked through

Re: How to overwrite existing file with SELECT .. INTO?

2007-04-16 Thread Amer Neely
At 08:14 AM 4/13/2007, Amer Neely wrote: I'm using MySQL 5.0.21 and am trying to find out if it is possible to overwrite an existing file when using a 'SELECT ... INTO' command from the command line. Is there another parameter that can do this? I've looked through the online reference manual

Re: How to overwrite existing file with SELECT .. INTO?

2007-04-15 Thread Devi
Hello Mike, AFAIK, What you have specified is applicable only for tables! But for file in Select ..into outfile, sure Exit handler is declared when we try to overwrite an existing file! Thanks DEVI.G - Original Message - From: mos [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent

Re: How to overwrite existing file with SELECT .. INTO?

2007-04-14 Thread mos
At 08:14 AM 4/13/2007, Amer Neely wrote: I'm using MySQL 5.0.21 and am trying to find out if it is possible to overwrite an existing file when using a 'SELECT ... INTO' command from the command line. Is there another parameter that can do this? I've looked through the online reference manual

<    3   4   5   6   7   8   9   10   11   12   >