Re: Select query problem

2006-07-27 Thread Dan Bolser
Barry wrote: Nenad Bosanac schrieb: Hi I have one problem that i can`t resolve. still need advice or is it solved? IF!!! you need IF!! :) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: SSH tunnel for Mysql

2005-11-22 Thread Dan Bolser
Jerry Swanson wrote: Both Linux computers. This is what I do... $ more ssh_to_mysql_on_beta #!/bin/sh ssh \ -t \ -g \ -L 3306:beta.domain.ac.uk:3306 \ [EMAIL PROTECTED] \ "./bin/sleep.plx mysql" That last line is a trick to prevent the terminal from 'timeing out'. The sleep.plx applic

Truly random 'groupie'

2005-08-25 Thread Dan Bolser
Hi, I think I saw this question being asked before, but I can't remember if their was a simple answer. If I have a table of two columns (PK and FK) with a one to many relationship, i.e. PK FK 1 a 2 a 3 a 4 b 5 b 6 b 7 c 8 c 9 d Ca

Re: Make a report like this...

2005-07-20 Thread Dan Bolser
t works, for example also with 'GROUP_CONCAT( ... SEPARATOR = "")' I was just looking for a text based report if possible. It seems it should be do-able in perl or similar, but I don't know if it has. Cheers, > >PB > >-- > >Dan Bolser wrote: > >>

Make a report like this...

2005-07-20 Thread Dan Bolser
+--+---+++-+ | G_ID | TOTAL | G2 | NR | ASSEMBLY_LISTING| +--+---+++-+ | 1132 |34 | 1 | 1 | 1bf3-1,1bgj-1,1bgn-1,1bkw-1,1cc4-1, | | | ||| 1cc6-1,1cj2

Re: SQL 'clustering' query?

2005-07-15 Thread Dan Bolser
concat_max_len system variable - For some reason I thought it would already be at the maximum lenght. I doubled it up and saw my warnings dissapear Warning: 1260 Thanks very much for the above links, Dan. > >PB > > >Dan Bolser wrote: > >>Hi, I remember reading about

SQL 'clustering' query?

2005-07-14 Thread Dan Bolser
Hi, I remember reading about an SQL query type which did something like select all 'aircraft hangers' which contained exactly (or at least) some given set of aircraft. Or did it select the list of pilots qualified to fly all the airplanes in the hanger... Anyway, I forget the syntax (and the fa

Query Complexity (big 'O')

2005-06-21 Thread Dan Bolser
Hello, I am interested in the theoretical time / space complexity of SQL queries on indexed / non-indexed data. I think I read somewhere that a JOIN on an indexed column is something like O[mn*log(mn)] (m rows joined to n). I assume without an index it is just O[m*n] Specifically I want to k

Re: Cumulative Totals

2005-05-25 Thread Dan Bolser
On Wed, 25 May 2005, Russell Horn wrote: >I have a pretty simple table with a list of payments, not much more >than: > >paymentID | amount | paymentDate >1| 123| 2005-01-10 >2| 77 | 2005-01-13 >3| 45 | 2005-02-16 >4| 13 | 2005-02-17 > > >I can get to

Re: Resetting Auto-increment

2005-05-24 Thread Dan Bolser
On Tue, 24 May 2005 [EMAIL PROTECTED] wrote: >Is there a better way to reset the auto_increment in a table, basically >there are several million rows in the database and the field that is >auto_increment is very large now and I don't want to exceed the limit of >the field description so I want to

Re: Query to select...

2005-05-24 Thread Dan Bolser
On Tue, 24 May 2005 [EMAIL PROTECTED] wrote: >Selon Dan Bolser <[EMAIL PROTECTED]>: > >> >> Hello, >> >> I have data like this >> >> PK GRP_COL >> 1A >> 2A >> 3A >> 4B >> 5B >> 6B >>

Re: Query to select...

2005-05-24 Thread Dan Bolser
>I agree, especially with the additional information the OP provided about >his REAL table structure. A separate groups table makes better sense. > >Let this be an object lesson to others looking for assistance: If you want >timely and useful assistance, provide real and complete information

Re: Query to select...

2005-05-24 Thread Dan Bolser
11ba | 1 | | 11ba| 1 | 11bg | 1 | | 12e8| 1 | 12e8 | 1 | | 12e8| 1 | 12e8 | 2 | ... Cheers, > > >Mathias > >Selon Dan Bolser <[EMAIL PROTECTED]>: > >> >> Hello, >> >> I have data like this >> >&

Query to select...

2005-05-24 Thread Dan Bolser
Hello, I have data like this PK GRP_COL 1 A 2 A 3 A 4 B 5 B 6 B 7 C 8 C 9 C And I want to write a query to select data like this... PK FK GRP_COL 1 1 A 2 1 A 3 1 A 4 4 B 5

Re: SCRAMBLE(A,B) (was UDF:Request).

2005-05-24 Thread Dan Bolser
On Mon, 11 Apr 2005 [EMAIL PROTECTED] wrote: >Dan Bolser <[EMAIL PROTECTED]> wrote on 04/11/2005 11:50:31 AM: > >> On Mon, 11 Apr 2005, Dan Bolser wrote: >> >> > >> >Requirement: >> > >> >Given two columns of a table (Column1 and Colum

Re: MySQL 4.1.12 has been released

2005-05-16 Thread Dan Bolser
On Sun, 15 May 2005, Matt Wagner wrote: >Hi, > >A new version of MySQL Community Edition 4.1.12 Open Source database >management system has been released. It is now available in source and >binary form for a number of platforms from our download pages at >http://dev.mysql.com/downloads/ and mirror

Re: Single vs Multiple primary keys

2005-05-15 Thread Dan Bolser
On Sun, 15 May 2005, Martijn Tonies wrote: >Bob, > >> I have a table, see below, that contains a single primary key >(SubTestCaseKey ) and a number of foreign keys >> >> * plantriggers_ID_FK , >> * testcase_root_ID_FK >> * testcasesuffix_name_FK >> >> What I want to ensure is that there are no dup

Re: amPiguous!

2005-05-15 Thread Dan Bolser
On Sat, 7 May 2005, Jochem van Dieten wrote: >On 5/7/05, Dan Bolser wrote: >> On Sat, 7 May 2005, Jochem van Dieten wrote: >>>On 5/7/05, Dan Bolser wrote: >>> >>>> select pk from a inner join b using (pk); >>>> >>>> ERROR 1052 (23000

Re: Efficiently finding a random record

2005-05-13 Thread Dan Bolser
On Fri, 13 May 2005, Eric Bergen wrote: >Even better is if you have an integer primary key (think auto_increment) >and use in() > >So if you want 10 random rows in your app generate 20 or so random >numbers and do something like >select col1, from t where x in (1, 5, 3, 2...) limit 10 > >check n

Re: SELECT DISTINCT ROW(A,B) ?

2005-05-07 Thread Dan Bolser
On Sat, 7 May 2005, Roger Baklund wrote: >Dan Bolser wrote: >> SELECT DISTINCT ROW(A,B) from a; >> >> While I am on a roll (of sorts) can I ask if the above syntax should be >> valid or not? > >If you mean the exact syntax above, I think not... it looks like

Re: amPiguous!

2005-05-07 Thread Dan Bolser
On Sat, 7 May 2005, Jochem van Dieten wrote: >On 5/7/05, Dan Bolser wrote: >> >> Why are columns included in the join between two tables ambigious? > >Because MySQL does not follow the SQL standard (ISO/IEC 9075-2:2003). > > >> select pk from a inner join b usi

SELECT DISTINCT ROW(A,B) ?

2005-05-07 Thread Dan Bolser
SELECT DISTINCT ROW(A,B) from a; While I am on a roll (of sorts) can I ask if the above syntax should be valid or not? I have a feeling it should be valid (but isn't - it causes an error). Is this the correct behaviour? -- MySQL General Mailing List For list archives: http://lists.mysql.co

Re: amPiguous!

2005-05-06 Thread Dan Bolser
ding. There is nothing that I would >>>call ambiguous in your query: you have a syntax error. The join should be >>>written: >>> >>> select pk from a inner join b on a.col1 = b.col2 >>> >>>Of course, you need to replace 'a.col1' and '

Re: amPiguous!

2005-05-06 Thread Dan Bolser
hat MySQL should know from the join that a.pk and b.pk are the same, >so it doesn't matter which one it uses. Exactly! Afterall a.pk = b.pk! However, I can imagine how this could become somewhat tricky with the ON syntax. > >-Simon > > > >> >> - Original Mes

Re: amPiguous!

2005-05-06 Thread Dan Bolser
ould the USING syntax 'disambiguate' columns in the select statement? > >Rhino > >- Original Message - >From: "Dan Bolser" <[EMAIL PROTECTED]> >To: >Sent: Friday, May 06, 2005 6:50 PM >Subject: amPiguous! > > >> >> Why a

amPiguous!

2005-05-06 Thread Dan Bolser
Why are columns included in the join between two tables ambigious? It seems that they should *not* be ambigious! Like this select pk from a inner join b using (pk); ERROR 1052 (23000): Column 'pk' in field list is ambiguous!!! Is this a bug, or is it like this for a reason? It drives me nuts,

Re: Relative Numeric Values

2005-04-17 Thread Dan Bolser
On Sat, 16 Apr 2005, David Blomstrom wrote: > >--- Kim Briggs <[EMAIL PROTECTED]> wrote: >> David, >> >> In reading through miscellaneous database design >> text on the web, I >> read just the other day that you should not try to >> include meaningful >> data in your key values. I assume there w

Re: Relative Numeric Values

2005-04-17 Thread Dan Bolser
On Sat, 16 Apr 2005, David Blomstrom wrote: >I think my question is more oriented towards PHP, but >I'd like to ask it on this list, as I suspect the >solution may involve MySQL. > >I'm about to start developing an enormous database >focusing on the animal kingdom and want to find a key >system mo

COUNT(DISTINCT R1,R2) within an IF statement?

2005-04-17 Thread Dan Bolser
Hi, I have a query which looks like this... SELECT BLEAH, COUNT(DISTINCT R1,R2) FROM T1 WHERE FK = 1 GROUP BY BLEAH ; Lets say that over 10 rows where FK = 1 it counts 5 distinct R1-R2 pairs in a single 'BLEAH' group BLEAH = 'Y'. Now I want to search the table for all FK's with the

Re: Size of BLOB types?

2005-04-16 Thread Dan Bolser
Beautiful! Cheers, (one and all), Dan. On Sat, 16 Apr 2005, Dan Nelson wrote: >In the last episode (Apr 16), Dan Bolser said: >> The manual dosn't specify the maximum number of characters in the >> >> TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT data types. >> &

Re: Size of BLOB types?

2005-04-16 Thread Dan Bolser
name would have the self respect to hold at least 65536 characters! Thanks for the pointers so far, Dan. > >- Original Message - >From: "Dan Bolser" <[EMAIL PROTECTED]> >To: "Hassan Schroeder" <[EMAIL PROTECTED]> >Cc: >Sent: Saturday

Re: Size of BLOB types?

2005-04-16 Thread Dan Bolser
On Sat, 16 Apr 2005, Hassan Schroeder wrote: >Dan Bolser wrote: >> The manual dosn't specify the maximum number of characters in the >> >> TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT data types. >> >> http://dev.mysql.com/doc/mysql/en/blob.html >> >&

Size of BLOB types?

2005-04-16 Thread Dan Bolser
The manual dosn't specify the maximum number of characters in the TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT data types. http://dev.mysql.com/doc/mysql/en/blob.html Are these valid synonyms, TINYBLOB, MEDIUMBLOB and LONGBLOB? I have a field with just under 1000 characters, am I OK with a TINYTEX

remove newline hack?

2005-04-15 Thread Dan Bolser
How to remove newlines from a column? Data is given me in binary format. If I dump should I set some new record terminator, parse out newlines and reload? Any beter hack? Dan. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.

Re: Group By - Is there a way to set which rows values are used for the fields not in the Group By clause?

2005-04-12 Thread Dan Bolser
om meTable a inner join bleah using(PK,the_original_column_name); Their should be a unique minimum for the_original_column. When I said before that 'you really need to know what you are doing' - what I mean is, I am very bad at explaining. Sorry if the above looks like garble (but I can

Re: Group By - Is there a way to set which rows values are used for the fields not in the Group By clause?

2005-04-12 Thread Dan Bolser
I think the suggestion posted here... http://lists.mysql.com/mysql/182424 should get you going in the right direction. You really need to know what you are doing to know if it is giving you the correct answer or not. It would be cool if their was something like a GROUP_ROW(cols, expr) to do wh

Re: SCRAMBLE(A,B) (was UDF:Request).

2005-04-11 Thread Dan Bolser
On Mon, 11 Apr 2005, Dan Bolser wrote: > >Requirement: > >Given two columns of a table (Column1 and Column2) of length x, return two >columns (Column1_Scram and Column2_Scram) such that the distributions of >values in Column1 and Column2 are preserved in Column1_Scram and >C

Re: Find valid numeric values in a string field?

2005-04-11 Thread Dan Bolser
;| my_col | >+----+ >| 0 | >| 1 | >| -1 | >++ >3 rows in set (2.78 sec) > >...et cetera. REGEXP is explained here: > >http://dev.mysql.com/doc/mysql/en/regexp.html > > >Eamon Daly &g

Re: Display 1st row of every group?

2005-04-11 Thread Dan Bolser
cit ordering. What do you mean? > >PB > >- > >Dan Bolser wrote: > >>On Mon, 11 Apr 2005, Rhino wrote: >> >> >> >>>- Original Message - >>>From: "Dan Bolser" <[EMAIL PROTECTED]> >>>To: >&g

SCRAMBLE(A,B) (was UDF:Request).

2005-04-11 Thread Dan Bolser
Requirement: Given two columns of a table (Column1 and Column2) of length x, return two columns (Column1_Scram and Column2_Scram) such that the distributions of values in Column1 and Column2 are preserved in Column1_Scram and Column2_Scram, but the pairs of values are randomized. Solution sugg

Re: Display 1st row of every group?

2005-04-11 Thread Dan Bolser
On Mon, 11 Apr 2005, Peter Brawley wrote: >/>I guess that entry is either wrong or misleading./ > >Ordering by another column which isn't mutually dependent with the >grouping column will have unpredictable results. Is that what you mean >by the example being "wrong or misleading"? No, I mean t

Re: Display 1st row of every group?

2005-04-11 Thread Dan Bolser
On Mon, 11 Apr 2005, Rhino wrote: > >- Original Message - >From: "Dan Bolser" <[EMAIL PROTECTED]> >To: >Sent: Monday, April 11, 2005 5:58 AM >Subject: Display 1st row of every group? > > >> >> I read with great interest th

Re: Display 1st row of every group?

2005-04-11 Thread Dan Bolser
a unique minimum value per id group. On Mon, 11 Apr 2005, Dan Bolser wrote: > >I read with great interest this > >http://www.artfulsoftware.com/queries.php#4 > >Display 1st row of every group > >SELECT id >FROM tbl >GROUP BY id >HAVING count(*) = 1; > >I wa

Display 1st row of every group?

2005-04-11 Thread Dan Bolser
I read with great interest this http://www.artfulsoftware.com/queries.php#4 Display 1st row of every group SELECT id FROM tbl GROUP BY id HAVING count(*) = 1; I want to use this syntax with an 'order by' like this... SELECT * FROM tbl GROUP BY id HAVING count(*) = 1 ORDER BY bleah;

Re: UDF Request "AGGLOM()"

2005-04-11 Thread Dan Bolser
On Mon, 11 Apr 2005, Arjen Lentz wrote: >Hi Dan, > >On Sat, 2005-04-09 at 02:59, Dan Bolser wrote: >> Who can I prod about setting up a UDF repo at MySQL. I think 'they' should >> do this ;) > >Yep it's an existing idea, a very good one, and it's on

Find valid numeric values in a string field?

2005-04-10 Thread Dan Bolser
I have a column like this "my_col varchar(20) null". The values in the column can be text or numbers. How can I select only those rows where the value in this column is a valid number? I need something like IS_DECIMAL(), but I can't find that function. The following SQL fails to do the job (pro

RE: UDF request?

2005-04-08 Thread Dan Bolser
On Fri, 8 Apr 2005 [EMAIL PROTECTED] wrote: >Dan Bolser <[EMAIL PROTECTED]> wrote on 04/08/2005 12:41:35 PM: > >> On Thu, 7 Apr 2005, Sean Nolan wrote: >> >> >I think you'll find you can do what you want with a cross join. A cross >join >> >w

Re: Thank you-regarding: Does such a JOIN exist that can create a pivot table?

2005-04-08 Thread Dan Bolser
On Fri, 8 Apr 2005, Jacob, Raymond A Jr wrote: >Does such a JOIN exist that can create a pivot table? > Thank you: > 182361 by: Dan Bolser > 182362 by: Peter Brawley > >Now I must go into my cave and meditate on these queries: >Ommm,Ommm,...O

Re: Does such a JOIN exist that can create a pivot table?

2005-04-08 Thread Dan Bolser
I think what you are talking about could be called a 'crosstabulation' or a crosstab. Their are some tutorials about making cross-tabs using perl. I have used them a lot, and they are really great. I tend to stack up lots of IF statemens... Table1 month person sex sales 1 a

UDF Request "AGGLOM()"

2005-04-08 Thread Dan Bolser
Who can I prod about setting up a UDF repo at MySQL. I think 'they' should do this ;) http://lists.mysql.com/community/97 Anyway I am posting this request to 'community' because I still don't know the appropriate place to post UDF related stuff. This is anoter (potentially crazy) idea for a UDF

RE: UDF request?

2005-04-08 Thread Dan Bolser
. > >So we could INNER JOIN using Dept and then RANDOM JOIN (as described >above) using Person - all in one 'JOIN'. All else being the same this >should randomize the Gender, but keep the marginals. > >I guess this is overly complex given the problem, and it actually rai

UDF request?

2005-03-31 Thread Dan Bolser
Hi, I have a request for a UDF that I would find really useful. I am duplicating this question on the community list as well as the MySQL list, because I am not sure where best to make this kind of request (see the previous post http://lists.mysql.com/community/97). I think the following syntax

Re: if statement help

2005-03-30 Thread Dan Bolser
I think I remember a match_at(":") or pat_index(":") UDF which would return the position of the first ":" for you, but I can't find it if it does exist. On Wed, 30 Mar 2005, Christopher Vaughan wrote: >I have data in a table listed as >44:22:22 >333:33:33 >It stands for hhh:mm:ss >I want to b

Re: Central UDF project at mysql.com?

2005-03-30 Thread Dan Bolser
such things? All the best, Dan. > >MarkP > >On Wed, 30 Mar 2005 14:39:11 +0100 (BST), Dan Bolser ><[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> I searched for previous discussion on this topic, but didn't find any. >> >> I would li

RE: The best way to transfer data to another server

2005-03-30 Thread Dan Bolser
On Wed, 30 Mar 2005, Denis Gerasimov wrote: > >> > >> > Hello list, >> > >> > I have two MySQL 4.1 servers, one local and one remote. I need to >> transfer >> > database from one server to another. What actually is the best way of >> > handling this task? >> > >> > Are there any standard MySQL too

Central UDF project at mysql.com?

2005-03-30 Thread Dan Bolser
Hi, I searched for previous discussion on this topic, but didn't find any. I would like to see a centralized MySQL hosted UDF archive and development project. The only existing 'archives' seem to be somewhat poorly maintained (sorry), and suffer for their duplicated efforts and being loosely di