Re: Broken Mac pref panel

2006-06-05 Thread Jeff Shapiro
On Sunday 04 June 2006 20:38, Marcus Bointon scribble on about:
 On 4 Jun 2006, at 23:25, Marcus Bointon wrote:
  I'm having trouble with the prefpane in OS X

 It seems I'm not alone - there are several reports of this in the
 MySQL bug tracker. Looks like a bug in the prefpane:

 http://bugs.mysql.com/bug.php?id=19577

In your original message your said that you just installed 5.0.22 (i686). I 
just upgraded my installation to  5.0.22 as well. However, I didn't update 
the preference pane software. My preference pane is still working correctly; 
however, it is from 5.0.20. (Which was a fresh install on a brand new MacBook 
Pro).

So, something may have broken in the lastest software. 

-- 
Life may have no meaning, or, even worse, it may have a meaning of which
you disapprove.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Fun with Dates and Incentives.

2006-05-26 Thread Jeff Shapiro
On Wednesday 24 May 2006 15:18, Brian Menke scribble on about:
 Peter, thanks for the detailed info. I will figure out how to get rid of
 the UNIQUE key. Somehow that got added. Thanks for the catch. As far as INT
 for student id goes, I'm using email because it will be unique, and offers
 an easy way to track a user through the app I'm building (user name,
 password, session id's etc.) but I do get what you are saying. Thanks for

Umm just a question here: What happens if the person changes his or her email 
address? That is if you are allowing them to change it. If you are using it 
as the table relationship key, it may break your relationships if it changes 
in the parent table.. You'll have to ensure that your parent and child table 
keys stay in sync. This could be a headache waiting to happen.

Normally, I place an autoincrement column in the parent table and use it as 
the relationship key for all child tables. This way I know that the value 
will never change and it's not part of data important to the end user or the 
application. This is basically what Peter suggested.

jeff

-- 
Counting in octal is just like counting in decimal--if you don't use your 
thumbs.
-- Tom Lehrer

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Fun with Dates and Incentives.

2006-05-26 Thread Jeff Shapiro
On Wednesday 24 May 2006 15:18, Brian Menke scribble on about:
 Peter, thanks for the detailed info. I will figure out how to get rid of
 the UNIQUE key. Somehow that got added. Thanks for the catch. As far as INT
 for student id goes, I'm using email because it will be unique, and offers
 an easy way to track a user through the app I'm building (user name,
 password, session id's etc.) but I do get what you are saying. Thanks for

Umm just a question here: What happens if the person changes his or her email 
address? That is if you are allowing them to change it. If you are using it 
as the table relationship key, it may break your relationships if it changes 
in the parent table.. You'll have to ensure that your parent and child table 
keys stay in sync. This could be a headache waiting to happen.

Normally, I place an autoincrement column in the parent table and use it as 
the relationship key for all child tables. This way I know that the value 
will never change and it's not part of data important to the end user or the 
application. This is basically what Peter suggested.

jeff

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Need Update Query Help (Urgent)

2006-02-20 Thread Jeff Shapiro
On Monday 20 February 2006 03:27, Veerabhadrarao Narra wrote:
 Hi

   i ahve one table table_1 and columns like col_1,col_2,col_3

 col_1   col_2  col_3
 1   aa aaa
 2   bb

   Now i want to update my table table_1 SET col_3 as bbb where max of col_1

 I wrote this below Query but it shows error how to write

 UPDATE table_1
 SET col_3 = 'bbb'
 WHERE  col_1 = (SELECT max(col_1) FROM table_1)

It appears that you can't do what you want. 

This is at the bottom of the UPDATE syntax page:
 Currently, you cannot update a table and select from the same table in a 
subquery.

http://dev.mysql.com/doc/refman/5.0/en/update.html


However, you can to something like:

select @maximum_column :=max(col_1) from table_1;
UPDATE table_1
SET col_3 = 'bbb'
WHERE  col_1 = @maximum_column;

Perhaps someone else has a better solution.

-- 
Jeff Shapiro
listserv only address

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: confirm unsubscribe to mysql@lists.mysql.com

2005-09-15 Thread Jeff Shapiro
On Thursday 15 September 2005 10:02, [EMAIL PROTECTED] wrote:
 To confirm that you would like

   [EMAIL PROTECTED]

 removed from the mysql mailing list, please click on
 the following link:

   http://lists.mysql.com/u/mysql/4329a93daa95db74/jeff.nensha=gmail.com

 This confirmation serves two purposes. First, it verifies that we are
 able to get mail through to you. Second, it protects you in case
 someone forges a subscription request in your name.

 We haven't checked whether your address is currently on the mailing list.
 To see what address you used to subscribe, look at the messages you are
 receiving from the mailing list. Each message has your address hidden
 inside its return path; for example, [EMAIL PROTECTED] receives messages
 with return path: mysql-return-number[EMAIL PROTECTED]


 --- Administrative commands for the mysql list ---

 I can handle administrative requests automatically. Please
 do not send them to the list address! Instead, send
 your message to the correct command address:

 For help and a description of available commands, send a message to:
[EMAIL PROTECTED]

 To subscribe to the list, send a message to:
[EMAIL PROTECTED]

 To remove your address from the list, just send a message to
 the address in the ``List-Unsubscribe'' header of any list
 message. If you haven't changed addresses since subscribing,
 you can also send a message to:
[EMAIL PROTECTED]

 or for the digest to:
[EMAIL PROTECTED]

 For addition or removal of addresses, I'll send a confirmation
 message to that address. When you receive it, simply reply to it
 to complete the transaction.

 If you need to get in touch with the human owner of this list,
 please send a message to:

 [EMAIL PROTECTED]

 Please include a FORWARDED list message with ALL HEADERS intact
 to make it easier to help you.

 --- Enclosed is a copy of the request I received.

 Received: (qmail 17020 invoked by uid 509); 15 Sep 2005 17:02:53 -
 Received-SPF: pass (lists.mysql.com: domain of [EMAIL PROTECTED]
 designates 64.233.162.192 as permitted sender) Received: from
 zproxy.gmail.com (HELO zproxy.gmail.com) (64.233.162.192) by
 lists.mysql.com (qpsmtpd/0.29) with ESMTP; Thu, 15 Sep 2005 19:02:52 +0200
 Received: by zproxy.gmail.com with SMTP id 18so294926nzp
 for [EMAIL PROTECTED]; Thu, 15 Sep 2005 10:03:37
 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
 s=beta; d=gmail.com;

 h=received:reply-to:organization:to:date:user-agent:mime-version:content-ty
pe:content-transfer-encoding:content-disposition:message-id:from;
 b=HSafd/KKV2nFxEZQ+Wu4wzSAvllc5NqIFzkxv3vhbUZvTeK/ozkETa9vo0v8V9jBcRHKVgfl3
uTBlmohcK4w4hBHoUPqZYi988i35yGFZwgY7PcbE/OS1fCHz91XcAQhs8Io1TsAbQWKhYMXGjEEn
9osp/BThrmaNnyccwvQczU= Received: by 10.36.247.7 with SMTP id
 u7mr3488418nzh;
 Thu, 15 Sep 2005 10:03:37 -0700 (PDT)
 Return-Path: [EMAIL PROTECTED]
 Received: from ?192.168.1.47? ( [71.102.133.117])
 by mx.gmail.com with ESMTP id j7sm287121nzd.2005.09.15.10.03.36;
 Thu, 15 Sep 2005 10:03:37 -0700 (PDT)
 Reply-To: [EMAIL PROTECTED]
 Organization: Nensha
 To: [EMAIL PROTECTED]
 Date: Thu, 15 Sep 2005 10:03:07 -0700
 User-Agent: KMail/1.8
 MIME-Version: 1.0
 Content-Type: text/plain;
   charset=us-ascii
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 Message-Id: [EMAIL PROTECTED]
 From: Jeff Shapiro [EMAIL PROTECTED]

-- 
Q:  Why did the chicken cross the road?
A:  He was giving it last rites.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQLDUMP Problem

2005-08-21 Thread Jeff Shapiro
On Thursday 18 August 2005 09:34, Carlos J Souza wrote:
 Sirs,

 When i use  mysqldump on Version 4.1.x, all tables had a one record insert
 generated in script. When i use mysqldump on a 4.0.x version this problem
 dos not occurs.

 How to solve it?

That's because extended inserts are on by default in 4.1.x. To get multiple 
inserts (usually slower) use a command like:

mysqldump --skip-extended-insert mydatabase  mydatabase.sql

-- 
Jeff Shapiro
listserv only address

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: I need the opposite of BINARY

2003-10-20 Thread Jeff Shapiro

You can change your query to something like:

somequery ... WHERE CONCAT(CAST(anumber as CHAR), aname) LIKE 
'12SomeString'

Using the CAST function seems to trick CONCAT into thinking that it 
only received CHARs.

Not that elegant but it might be a little more efficient that using 
LOWER() or UPPER().

On Mon, 20 Oct 2003 18:05:58 +0200 (CEST), Thomas Spahni spoke thusly 
about RE: I need the opposite of BINARY:
 Simon
 
 you missed this from the manual:
 
 quote
 If you want to convert a number to a string explicitly, pass it as the
 argument to `CONCAT()'.
 
 If a string function is given a binary string as an argument, the
 resulting string is also a binary string.  A number converted to a
 string is treated as a binary string.  This only affects comparisons.
 
 Normally, if any expression in a string comparison is case-sensitive,
 the comparison is performed in case-sensitive fashion.
 unquote
 
 It is well documented. My question was about how I could change this,
 because I want to perform a comparison in a NON-case-sensitive fashion.
 
 Thomas Spahni
 
 
 On Mon, 20 Oct 2003, Simon Green wrote:
 
  CONCAT turns every this in to a string then puts them together?
  LIKE is not case sensitive with string?
  When is this turned in to BINARY?
 
  What have I missed please
  Simon
 
  -Original Message-
  From: Thomas Spahni [mailto:[EMAIL PROTECTED]
  Sent: 20 October 2003 15:38
  To: [EMAIL PROTECTED]
  Subject: I need the opposite of BINARY
 
 
  Hi,
 
  I do the following:
 
  somequery ... WHERE CONCAT(anumber, aname) LIKE '12SomeString'
 
  As explained in the manual this is treated as a BINARY comparison i.e.
  case of the letters matter. I need a case independent comparison here. Is
  there a way to get the usual behaviour of LIKE in this case? (besides
  translating all characters to LOWER which is IMHO no elegant solution).
 
  TIA
  Thomas Spahni

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Creating Triggers and procedures in MySQL

2003-10-05 Thread Jeff Shapiro

Information from the manual:

1.7.4.4  Stored Procedures and Triggers 

Stored procedures are being implemented in our version 5.0 development 
tree. See section 2.3.4  Installing from the Development Source Tree .

This effort is based on SQL-99, which has a basic syntax similar (but 
not identical) to Oracle PL/SQL. In addition to this, we are 
implementing the SQL-99 framework to hook in external languages. 

A stored procedure is a set of SQL commands that can be compiled and 
stored in the server. Once this has been done, clients don't need to 
keep re-issuing the entire query but can refer to the stored procedure. 
This provides better overall performance because the query has to be 
parsed only once, and less information needs to be sent between the 
server and the client. You can also raise the conceptual level by 
having libraries of functions in the server. However, stored procedures 
of course do increase the load on the database server system, as more 
of the work is done on the server side and less on the client 
(application) side. 

Triggers will also be implemented. A trigger is effectively a type of 
stored procedure, one that is invoked when a particular event occurs. 
For example, you can install a stored procedure that is triggered each 
time a record is deleted from a transactional table and that stored 
procedure automatically deletes the corresponding customer from a 
customer table when all his transactions are deleted. 

=

Last time this was brought up, there was a long discussion between the 
I love stored-procedures and the I hate store-procedure groups of 
people. Hopefully, we won't get that again. If you are interested in 
the lengthy discussion, you may want to search the list archives.

On Mon, 06 Oct 2003 10:54:48 -0850 (CDT), Gregory Hicks spoke thusly 
about Creating Triggers and procedures in MySQL:
 Hi All,
 
 I am looking into putting triggers, procedures and into MySQL.
 
 The tools I am using seem to lack this facility, unless MySQL doesnot 
 actually have 
 these important database features.
 
 Any help is appreciated.
 
 Gregory Hicks
 Database Analyst Programmer

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: case sensitive?

2003-09-23 Thread Jeff Shapiro

From the MySQL manual

A.5.1  Case-Sensitivity in Searches 

By default, MySQL searches are case-insensitive (although there are 
some character sets that are never case-insensitive, such as czech ). 
That means that if you search with col_name LIKE 'a%' , you will get 
all column values that start with Aor a. If you want to make this 
search case-sensitive, use something like INSTR(col_name, A)=1 to 
check a prefix. Or use STRCMP(col_name, A) = 0 if the column value 
must be exactly A .

Simple comparison operations ( =, , = ,  , = , sorting and 
grouping) are based on each character's ``sort value''. Characters with 
the same sort value (like E, e and é) are treated as the same 
character! 

In older MySQL versions LIKE comparisons were done on the uppercase 
value of each character (E == e but E  é).  In newer MySQL versions 
LIKE works just like the other comparison operators. 

If you want a column always to be treated in case-sensitive fashion, 
declare it as BINARY . See section 6.5.3 CREATE TABLE Syntax .

If you are using Chinese data in the so-called big5 encoding, you want 
to make all character columns BINARY . This works because the sorting 
order of big5 encoding characters is based on the order of ASCII codes. 


On Tue, 23 Sep 2003 10:37:24 -0700, Hsiu-Hui Tseng spoke thusly about 
case sensitive?:
 Hi,
 
 I have questions on string comparison:
 
 Table: user_att
 +-+--+--+-+-+---+
  Field   | Type | Null | Key | Default | Extra |
 +-+--+--+-+-+---+
  user_id | int(11)  |  | PRI | 0   |   |
  att_id  | int(11)  |  | PRI | 0   |   |
  value   | varchar(200) |  | | |   |
  date| datetime | YES  | | NULL|   |
 +-+--+--+-+-+---+
  - one unique index on user_id and att_id (pk)
  - one index on att_id and user_id.
 
 SELECT * FROM user_att WHERE att_id = 123 and value = 'SANDY';
 SELECT * FROM user_att WHERE att_id = 123 and value = 'sandy';
 SELECT * FROM user_att WHERE att_id = 123 and value like 'sandy';
 
 The first 2 queries are faster. They result are all the same.
 
 However, if I want to retrieve only 'sandy' instead of 'Sandy'. Is there any
 query to achieve that?
 
 Is there anyway to configure mysql to be case sensitive?
 
 Thanks!
 
 Hsiu-Hui

---
Listserv only address.
Jeff Shapiro

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: NewbieALERT - Question/problem

2003-08-31 Thread Jeff Shapiro

You are looking for the ALTER TABLE statement. Here's a link to the 
manual page about it:
http://www.mysql.com/doc/en/ALTER_TABLE.html

Your command should be something like:

ALTER TABLE Custumer_data
ADD field14 tinyint DEFAULT 1,
ADD field15 tinyint DEFAULT 1,
ADD field16 enum('no', 'yes') DEFAULT 'no',
ADD field17 tinyint DEFAULT 1,
ADD field18 enum('no', 'yes') DEFAULT 'no';

Of course you will need to make the column types whatever you really 
want them to be, along with the column names. 

If you include the DEFAULT clause when creating a new column, MySQL 
will automatically update the existing rows to contain the default 
value.


On Sun, 31 Aug 2003 15:04:08 +0200, Ryan A spoke thusly about 
NewbieALERT - Question/problem:
 Hi,
 Am pretty new to mysqls power so kindly excuse if some of the questions are
 very basic.
 
 I have a table Cusomer_Data with 13 fields, (for the sake of simplicity lets
 call the fields 1 to 13)
 I want add 5 more fields after the 13th one and add the default falues of
 
 1,1,'no',1,'no'
 to all the old records as the table is already populated and  I *dont* want
 to lose the data that is already in the table
 
 Can you tell me how to do that (sql statement) or kindly point me to some
 resource where i can read up on it please?
 
 Will I need multiple statements or just one query?
 
 Thanks,
 -Ryan
 
 
 
 We will slaughter you all! - The Iraqi (Dis)information ministers site
 http://MrSahaf.com

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: What is a good benchmark?

2003-07-25 Thread Jeff Shapiro

I have only a G3 400 Mhz machine while not that fastest around I 
discovered something interesting. Here's numbers for a 20 run average 
using different terminal applications:

Apple Terminal.app  2.8145 sec
X-11 xterm  2.597  sec.

The X-11 terminal was consistently faster than Apple's Terminal.app. 
Only 25% of the runs in xterm were slower than the fastest time in 
Terminal.app.

I'm running MySQL 4.0.13.

Just thought that it was interesting.

On Wed, 23 Jul 2003 14:00:48 -0500, mos spoke thusly:
 At 01:45 PM 7/23/2003, you wrote:
Is it me or do these dual athlons seem rather responsive!
 
 Yay!! I win (so far... heh)!
 
 Beat you by a nose. (Of course I had to run it 2 or 3 times to shave 
 a couple hundreds of a second off the times)g
 A single P4 2.4 Ghz 1g RAM running MySQL 4.1.0 Alpha running on Win2k 
 no less.
 
 Yes, you were beaten by a single horse CPU running on a Windoze 
 machine (how are you going to live it downg).
 I'm surprised no one has  3ghz CPU's out there. I never thought my 
 computer was that fast. Maybe it was the wind direction?
 
 Mike
 
 
 mysql select BENCHMARK(100,ENCODE(hello,goodbye));
 +--+
 | BENCHMARK(100,ENCODE(hello,goodbye)) |
 +--+
 |0 |
 +--+
 1 row in set (0.53 sec)

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Q: LOAD DATA command error

2003-06-23 Thread Jeff Shapiro
On Tue, 24 Jun 2003 00:02:43 -0400, mysql wrote:
 I use version 4.0.12-max-debug.
 
 mysql returns the following error code when I use the load data command.
 
 mysql load data local infile foo.txt into table pet;
 ERROR 1148: The used command is not allowed with this MySQL version
 
 Do I need to upgrade to a new version?

Information from:
http://www.mysql.com/doc/en/LOAD_DATA_LOCAL.html

In the case that LOAD DATA LOCAL INFILE is disabled in the server or 
the client, you will get the error message (1148):

The used command is not allowed with this MySQL version

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Syntax question

2003-06-16 Thread Jeff Shapiro



On Mon, 16 Jun 2003 12:45:53 -0400, Martin's - Web Dept. wrote:
 I am quite willing to acknowledge that I'm new at this ...
 
 But I can't find the syntax error in this query:
 
 SELECT * FROM products WHERE MATCH (desc) AGAINST ('usb')
 
 desc is a field name, usb is the keyword I'm searching for.

As mentioned in another post desc is a reserved work and needs to be 
enclosed in back ticks like `desc`.

Also, your select still won't return any rows because you are searching 
for 'usb' which is three characters and the default minimum word length 
for fulltext searches is 4 characters. 

You may want to read:
http://www.mysql.com/doc/en/Fulltext_Search.html
and
http://www.mysql.com/doc/en/Fulltext_Fine-tuning.html

If you need to search for 3 character words, you need change your 
my.cnf file to contain the following:
set-variable = ft_min_word_len=3

And restart the MySQL server.

 
 MYSQL version 4.0.12
 
 Thanks for your help.
 
 Ryan
 
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Two Table Query

2003-06-15 Thread Jeff Shapiro

The solution depends on which version of MySQL you are using. If you 
are using 4.1, you the easiest solution is to use a sub-select. 

Something like this may work:

SELECT m.member_number, m.name, s.status, s.date
FROM members AS m, status AS s ON 
WHERE m.member_number = s.member_number
AND m.member_number NOT IN
(SELECT member_number FROM status WHERE status != 'Active' and date = 
'2000-07-01')
AND s.date = '2000-07-01';

// This is not tested. I'm not running 4.1.

Otherwise you will need to use two queries like:

CREATE TEMPORARY TABLE inactive
SELECT member_number FROM status WHERE status != 'Active' and date = 
'2000-07-01';

SELECT m.member_number, m.name, s.status, s.date
FROM members AS m
JOIN status AS s ON m.member_number = s.member_number
LEFT JOIN inactive AS i ON m.member_number = i.member_number
WHERE i.member_number IS NULL
AND s.date = '2000-07-01';

These statements produce:
mysql [test] select * from inactive;
+---++--+
| member_number | date   | status   |
+---++--+
| 1 | 2000-06-01 | Inactive |
+---++--+
1 row in set (0.01 sec)

/// second select from above.
+---++++
| member_number | name   | status | date   | 
+---++++
| 2 | Lee Ramsey | Active | 2000-02-01 |
+---++++
1 row in set (0.00 sec)


Of course you would need to change status and date to what ever you are 
looking for.

Your create table statement for the Status table has member_number int 
unsigned AUTO_INCREMENT, you probably don't want the auto_increment on 
the column. 

I'm sure that if there is a better way, someone will point it out.

On Sun, 15 Jun 2003 07:44:24 -0500, [EMAIL PROTECTED] wrote:
 Greetings-
 
 I request your help constructing a query to return a list of active 
 members based on the following:
 
 CREATE TABLE Members(
   member_number int unsigned AUTO_INCREMENT,
   name  varchar(25),
   PRIMARY KEY(member_number))
 
 CREATE TABLE Status(
   member_number int unsigned AUTO_INCREMENT,
   date  DATE,
   statusenum('Active', 'Inactive', 'Retired'))
 
 So I might get:
 Members:
 1  Greg Lindstrom
 2  Lee Ramsey
 3  Don Tackett
 
 Status:
 1  2000/1/1  Active
 2  2000/2/1  Active
 1  2000/6/1  Inactive
 3  2000/8/1  Active
 1  2000/9/1  Active
 2  2001/1/1  Retired
 
 I would like the status table so I can calculate time served, but I 
 do not know how to construct a query to return all members with a 
 given status for a given date. 
 
 Example:  for 2000/7/1 and 'Active' 
  2 Lee Ramsey Active
 
 and for 2001/2/1 and 'Active'
  1 Greg Lindstrom Active
  3 Don TackettActive
 
 and 2001/2/1 'Retired'
  2  Lee Ramsey  Retired
 
  This would be possible to do in an external Python method (I'm 
 working in Zope), but from what I've learned about SQL in the past 6 
 months, I'm thinking it could be done internally (non-corrolated 
 join?).
 
 Thanks for your help,
 Greg Lindstrom
 Vilonia, Arkansas (USA)

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: establishing a relationship

2003-06-06 Thread Jeff Shapiro

Ted,

If in fact you only have a one-to-many relationship, you don't need the 
third table (what's also known as a join table in some circles). This 
type of table is only really needed if you are doing a many-to-many 
(people have 0 to infinity machines, and machines have 0 to infinity 
people).

I fail to see how adding a layer of complexity would help when deleting 
or updating records. Unless, of course, you are doing transaction 
logging manually. Which might be necessary with some DBMS products, but 
I don't think you need to in MySQL because you have the binary and 
other logs available. But then, you would need more information in the 
third table than just the two primary keys. I wouldn't mind hearing 
from your friend about why this type of set up is beneficial.

jeff

On Fri, 06 Jun 2003 02:14:37 -0400, [EMAIL PROTECTED] wrote:
 I have a friend teaching me but I want more :-) (second opinions), please.
 
 A simple Database:
 2 tables
 a one-to-many relationship
 each table has a Primary Key:  table1 (one) Primary Key = peopleID; 
 table2 (many) Primary Key = machinesID
 
 Normally, I would put the peopleID also in table2 as a Foreign key to 
 establish the relationship and be done with it.
 
 I am being taught now to create a third table, table3, and in it have 
 2 columns; those being the peopleID and machinesID (the Primary keys 
 from the other 2 tables).  This is apparently a good idea when it 
 comes to deleting or updating records. (?)
 
 My question is, how is the relationship between table1 and table2 
 established using this method?
 
 I hope you understand my question.  If I try to explain further it 
 will only become convoluted, possibly more than it is!
 
 Thanks,
 Ted Rogers

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Copy Struct and Data

2003-06-03 Thread Jeff Shapiro

You should probably use mysqldump for this. For information on this 
program, check out:
http://www.mysql.com/doc/en/mysqldump.html

On Mon, 02 Jun 2003 14:21:06 -0300, Celso wrote:
 Hi people,
 What I need make to copy Struct and Data from Database in my machine 
 to another machine (export) in the web ? 
 The my host in the web work with phpMySQL. 
 tks, 
 Celso
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Using varchar or something else?

2003-06-02 Thread Jeff Shapiro
On Sun, 1 Jun 2003 14:53:54 +0100, Dan wrote:
 I have used varchar for ALL my fields as this is the only one i know.
 
 Alot of my rows just contain image link text ie.
 
 /image/logoa.gif
 
 Is using varchar overkill for these fields?.  Would i be better using 
 something else?

It depends. We would need a lot more information about your data and 
application before we could make any meaningful suggestions.

 Any advice?
 
 TIA
 Dan
 
 
 ps. for my row which contains numbers it seems i can use either 
 numeric or int ?  What's the difference, which should i use?

Numeric type (really is decimal type):
An unpacked floating-point number.  Behaves like a CHAR column: 
``unpacked'' means the number is stored as a string, using one 
character for each digit of the value.  The decimal point and, for 
negative numbers, the `-' sign, are not counted in M (but space for 
these is reserved). If D is 0, values will have no decimal point or 
fractional part.  The maximum range of DECIMAL values is the same as 
for DOUBLE , but the actual range for a given DECIMAL column may be 
constrained by the choice of M and D.  If UNSIGNED is specified, 
negative values are disallowed.If D is omitted, the default is 0.  
If Mis omitted, the default is 10.  Prior to MySQL Version 3.23, the 
Margument must include the space needed for the sign and the decimal 
point. 

Int type:
INT[(M)] [UNSIGNED] [ZEROFILL] 
A normal-size integer. The signed range is -2147483648 to 2147483647 .  
The unsigned range is 0 to 4294967295.

So yes there is a difference.


 pps.  is there a list which specifys all options and their uses?

The manual? Which was installed along with MySQL.

/usr/local/mysql/manual.txt
/usr/local/mysql/manual.html

or where ever you install location is.

Or at:
http://www.mysql.com/doc/en/Column_types.html

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Advice on improving our current method

2003-06-02 Thread Jeff Shapiro
 of updating our 
 database.
 
 We have a Music chart it is a table with 3 columns
 
 Chart Number  (ie,  1,2,3,4,5,6,7,8,9,10..)
 Artist  (Artists Name)
 Title (Title of Song)
 
 Each week we login using mysql control center to make changes to the 
 chart positions
 
 The problems is this is currently a very time consuming manual job 
 changing the 'Chart Number' Column
 
 1
 2
 3
 4
 5
 etc.
 
 If for example we move song number 5 up to number 1,  we then have to 
 manually change the
 ' Chart Number'  of all the ones below it,  i.e. changing the old 
 number 1 to a number 2,
 number 2 to a number 3, number 4 to a number 5 etc.
 
 Ideally we need to keep using mysqlcc because it is very simple to 
 use, but it is very time consuming.
 
 Any suggestions?
 
 

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Advice on improving our current method

2003-06-02 Thread Jeff Shapiro

Perhaps I'm being a bit slow today. I don't see (or maybe I haven't 
found the magic syntax) that would allow a table index to handle the 
re-sequencing of information.

On Sun, 1 Jun 2003 14:09:15 -0400, Martin Gainty wrote:
 let the DB manage the sequencing before and after Make Chart # an Index
 Martin
 - Original Message -
 From: Don Read [EMAIL PROTECTED]
 To: Daniel Crompton [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Sunday, June 01, 2003 1:54 PM
 Subject: RE: Advice on improving our current method
 
 
 
  On 01-Jun-2003 Daniel Crompton wrote:
  snip
 
 
  If for example we move song number 5 up to number 1,  we then have to
  manually change the
  ' Chart Number'  of all the ones below it,  i.e. changing the old number
  1 to a number 2,
  number 2 to a number 3, number 4 to a number 5 etc.
 
  Ideally we need to keep using mysqlcc because it is very simple to use,
  but it is very time consuming.
 
  Any suggestions?
 
 
 
  SET @rank:=5;
 
  UPDATE music SET chart=0 WHERE [EMAIL PROTECTED];
  UPDATE music SET chart=chart+1 WHERE chart@rank;
 
  Regards,
  --
  Don Read   [EMAIL PROTECTED]
  -- It's always darkest before the dawn. So if you are going to
 steal the neighbor's newspaper, that's the time to do it.
  (53kr33t w0rdz: sql table query)
 
 
  --
  MySQL General Mailing List
  For list archives: http://lists.mysql.com/mysql
  To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
 
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: database newbie

2003-05-31 Thread Jeff Shapiro

Foreign keys have been available in InnoDB tables since 3.23.43b.

A here's couple of pages to check out:

From the InnoDB Manual pages:
4.3  Foreign key constraints 
http://www.innodb.com/ibman.html#InnoDB_foreign_keys

From the MySQL Manual:
1.8.4.5  Foreign Keys 
http://www.mysql.com/doc/en/ANSI_diff_Foreign_Keys.html

3.5.6  Using Foreign Keys 
http://www.mysql.com/doc/en/example-Foreign_keys.html

7.5.5.2  Foreign Key Constraints 
http://www.mysql.com/doc/en/InnoDB_foreign_key_constraints.html

additional comments inline:

On Fri, 30 May 2003 14:04:37 -0400, Ted Rogers wrote:
 No, this was perfect.  I had totally misread (I figured out after I 
 bothered everyone!) --it was I had always been taught and as you say.
 
 I hope you have seen my most recent question to the list?  About 
 manually entering the data?  The short and sweet answer there be that 
 someone ALWAYS has to enter ALL the data, that the database is for 
 retreival of what has been put in, manually.  though the db can do a 
 lot fancy footwork ;-).

Be careful of using always and all they will come back to bite you 
grin. My programming style is such that the user is rarely, if ever, 
shown the values that I'm using for primary and foreign keys. This 
comes from having to spend LOTS of time cleaning up some legacy systems 
that were broken by the end users editing the values. Also, unless I 
have reason to do otherwise, my Primary Key and my Foreign Keys are 
usually an auto_increment columns. Actually, I don't remember the last 
time that a Foreign Key wasn't based on an auto_increment column.  When 
creating child records, I have the system insert the parents 
auto_incremented value into the proper column of the child record. 
Therefore, no human intervention is required to enter data into the 
tables. 

 
 Now about foreign keys:  I have updated MySQL to 4.0.12 and changed 
 my tables to InnoDB, because someone said that is where this might be 
 leading! i.e., I don't know.  I do know, or think I do, that MySQL 
 does NOT have/handle Foreign Keys.  So what do I do?
 
 Thanks Ted
 

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Multiple lookups for one item in one description table

2003-05-30 Thread Jeff Shapiro
James,

What you are describing is a many-to-many relationship and is very 
commonly done. 

You should be able to get your desired output using your existing 
structure with something like:

SELECT i.item_id AS Item Number,
   i.item_desc AS Item Description,
   o.option_desc AS Option Description
FROM items AS i, options AS o, items_to_options AS ito
WHERE i.item_id = ito.item_id
  AND ito.option_id = o.option_id
ORDER BY i.item_id, o.option_desc;

This produces the following:
+-+--++
| Item Number | Item Description | Option Description |
+-+--++
|   1 | car1 | engine |
|   1 | car1 | seat   |
|   1 | car1 | steering wheel |
|   1 | car1 | tires  |
|   2 | car2 | engine |
|   2 | car2 | steering wheel |
|   2 | car2 | tires  |
|   3 | car3 | seat   |
|   3 | car3 | steering wheel |
|   3 | car3 | tires  |
+-+--++
10 rows in set (0.00 sec)

You may want to consider using InnoDB tables instead of MyISAM tables 
for Foreign Key support. Take a look at: 
http://www.mysql.com/doc/en/Table_types.html

To retrieve data from more than one table at a time, check out:
http://www.mysql.com/doc/en/JOIN.html



On Thu, 29 May 2003 00:10:49 -0600, James wrote:
 Hello,
 
 Our company is currently redesigning its MySQL database to be more
 efficient. Right now, our major concern is how to effectively do
 multiple value lookups in one value table without sacrificing our
 searching capability.
 
 Basically, we are trying to link an Item from one table to multiple
 Options in another table without replicating too much data. Item 1
 (lets say car1) has options 1, 2, 3  4 (doors, wheels, engine, sunroof)
 for example. Our current system (see below for an example) has a table
 in the middle that acts a reference table of sorts, which works alright,
 but we are currently doing two or more queries at run time; One to
 select and compile the multiple options into a single text string, and
 one to select the rest of the items info. Then we combine both queries
 and fire them out to a web page. 
 
 What we would like to see is a single MySQL select query that joins the
 data for us into another string using the 'AS' name construct (not
 necessarily with the current database structure, we are open to all
 options at this point). If that is not possible (or recommended) any
 suggestions on how to improve  re-organize for efficiency is greatly
 appreciated.
 
 Example of existing system:
 
 Table item
 
 item_id - 1
 item_desc - car1
 
 Table item_TO_options
 -
 item_id
 option_id
 
 Data for Table item_TO_options
 
 item_id | option_id
 11
 1... 2
 1... 3
 14
 
 
 Table options
 -
 option_id
 option_desc
---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: computed columns

2003-05-27 Thread Jeff Shapiro
On Tue, 27 May 2003 12:18:13 -0400, David Shelley wrote:

 I'm new to mySQL, but like what I see so far.
 I'm converting several databases from other products to mySQL 4.0.12 for
 improved speed and reliability. But I'm having trouble with computed
 columns. I don't see how to define them. Can't find it in the manual.pdf.

You don't see how to define them because I don't think that MySQL (or 
any SQL engine) has them. Plus, I would bet that using calculated 
columns violates some type of data normalization, and would also 
probably slow down MySQL considerably.

It sounds like you are trying to convert some FileMaker data tables. 
Off the top of my head it's the only system that lets (actually forces) 
you to do calculated values in the data table. (It's my biggest pet 
complaint about FMP along with repeating values.)

 I need 2 computed columns, 1st takes the columns fName and lName and appends
 them together with a space between. 2nd column, numDays, takes sDat
 (contract start date) and eDat (end date) and calculates eDat-sDat+1.
 
 Can someone please help me figure out how to define these columns.

You can do what you want on retrieval (or for that matter on INSERTion) 
with:

SELECT CONCAT(fName, ' ', lName) as FullName,
(TO_DAYS(eDat) - TO_DAYS(sDat) + 1) as DaysDuration
FROM mytable;

But, then you probably already knew that. grin

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: computed columns

2003-05-27 Thread Jeff Shapiro
On Tue, 27 May 2003 15:23:28 -0400, David Shelley wrote:
 Actually it's not FileMaker that the old database is in, it's R:Base.

I haven't heard of R:Base in YEARS.
 
 I was hoping mySQL supported calculated columns because they're mentioned a
 couple of times in the manual.pdf for version 4.0.3.

What the manual is referring to as calculated columns are the columns 
in a select statement (like the ones mentioned below). Which isn't what 
you are wanting.

 Thanks for the suggestion on select concat ...
 I realize I could do that but I was hoping to make the conversion to mySQL
 with as few code changes as possible to ensure cross compatability with
 various databases. I could also solve this with triggers and/or stored
 procedures if they were supported. Or I could recode the inserts and updates
 but that would also involve code changes.

Well, off hand. I'd say that you are going to have to do some recoding. 
Hopefully, someone else will have a better idea.

  snip  snip .
 You can do what you want on retrieval (or for that matter on INSERTion)
 with:
 
 SELECT CONCAT(fName, ' ', lName) as FullName,
   (TO_DAYS(eDat) - TO_DAYS(sDat) + 1) as DaysDuration
   FROM mytable;

---
Listserv only address.
Jeff Shapiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: cannot connect to mysql server

2003-04-05 Thread Jeff Shapiro
At 12:00 -0500 4/5/03, Peter Gumbrell wrote:
I have installed mysql on Mac OS X. when I attempt to access it 
either through a php page or through Terminal, I receive this 
message;

Can't connect to local MySQL server through socket '/tmp/mysql.sock'
mysqld isn't running.

You can check to see if it is running with (run this in a terminal window):

cd /usr/local/mysql

./bin/mysqlamdin ping

to start mysqld use:

 shell bin/safe_mysqld --user=mysql 
 or
 shell bin/mysqld_safe --user=mysql 
 if you are running MySQL 4.x
--user=msyql should be the user that you set up to own the msql directories.

I have just switched to a Mac and am unfamiliar with many aspects of 
unix. I read something about creating a symbolic link but am unsure 
how to do this and if this will solve the problem.

Any help would be greatly appreciated.

Peter

[EMAIL PROTECTED]
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Re: [MySQL] RE: Question: Connecting MySQL with DreamWeaver MX on Windows 2000

2003-04-04 Thread Jeff Shapiro
This is more of a DreamWeaver question than a MySQL and you will 
probably have better luck getting an answer from a DreamWeaver list 
or forum.

Have you tried searching the DreamWeaver Help or manuals?

A quick search for MySQL provided me with the following topics:

Creating the MySQL database
Setting the MySQL Connection dialog box options
Creating a database connection
Connecting to a database
Database Connections for PHP Developers
plus 25 other topics.

This search took me less than 30 secs. to find the solutions to your 
question.

At 13:01 -0500 4/4/03, [EMAIL PROTECTED] wrote:
Thanks for the info, i've searched and searched the mysql site for 
info but not found a lot, except people who got the error 1067 code 
helping each other.  i noticed a NOT FOUND under ODBC so i installed 
myodbc, but now i get the NOT FOUND along with the driver info 
underneath it, so i'm not exactly sure what's up.  i still can't 
create a database using winmysqladmin.exe or thru the prompt so i'll 
have to keep messin with it.

as i said previously, i'm sure everything will seem totally logical 
once i get used to it, but for right now it's a little difficult. if 
i could just create a database and connect with dwMX i'd be set.

: )

- Original Message -
From: Nestor Florez
To: [EMAIL PROTECTED]
Sent: Friday, April 04, 2003 12:43 PM
Subject: Re: Re: [MySQL] RE: Question: Connecting MySQL with 
DreamWeaver MX on Windows 2000

I do not understand why people have to get hard on other people just 
because they ask a question.  If you do not a helpful thing to say 
well do not reply.  The reason why people ask is because there are 
looking for shortcuts that are known by those who have been around 
and it is great because you do not have to reinvent the wheel.

Kira,  Try searching on freshmeat.net   They have tools that will 
actually install all of this software packages for you or you can do 
a search on google for PHP DREAMWEAVER MYSQL WINDOWS

Have a good weekend people,

:-)
---Original Message---
From: Ashley M. Kirchner [EMAIL PROTECTED]
Sent: 04/04/03 09:04 AM
To: [EMAIL PROTECTED]
Subject: Re: [MySQL] RE: Question: Connecting MySQL with DreamWeaver 
MX on Windows 2000

 [EMAIL PROTECTED] wrote:

 yes i know that.  How? was my question.
How...what?  How to setup MySQL?  How to setup PHP?  How to read the
manual?  How to work your own computer?  You ask vague questions, and
can only expect vague answers back.
 and the manual have you seen how long that is?
Yes, which is what makes it a good manual.  There is a reason why
they give you a Table of Contents right at the very beginning.  It's
less than 2 pages long and all you have to read is the Installation
section.  After that, you can read how to create your own databases.
 You're making this way harder than it really is.  You think you have to
read the whole manual, instead of reading the sections you need help with.
 when i looked under What is MySql?  it says  MySql is a powerful
 database tool blah blah.  MySql can do this and this and this
When you're trying to learn how to drive a car, what do you do?  Ask
first what a car is?
 I decided not to frustrate myself for 8 hours on this,
No, instead you're asking someone else to chew your food for you,
and have you swallow it.  Like I said, if you took the time to even read
the table of contents, you would've quickly found out which sections
specifically you needed to read - it's very short and can be done within
10 minutes.
--
H| I haven't lost my mind; it's backed up on tape somewhere.
  +
  Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
  IT Director / SysAdmin / WebSmith . 800.441.3873 x130
  Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
  a target=_blank href=http://www.pcraft.com;http://www.pcraft.com/a
. .  ..   Boulder, CO 80303, U.S.A.




--
MySQL General Mailing List
For list archives: a target=_blank
href=http://lists.mysql.com/mysql;http://lists.mysql.com/mysql/a
To unsubscribe:a target=_blank
href=http://lists.mysql.com/[EMAIL PROTECTED]http://lists.mysql.com/[EMAIL 
PROTECTED]/a

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: 
http://lists.mysql.com/[EMAIL PROTECTED]
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: select help

2003-04-02 Thread Jeff Shapiro

If you want to be a bit more generic you could do something like this:

# store the desired OS ID into a variable
SELECT @desired_id := os_id FROM os_table WHERE os_name = win nt;

# now find the solutions that match with the os_id
SELECT o.os_id, o.os_name, s.os_code, s.solution
FROM os_table o, solution_table s
WHERE (o.os_id  s.os_code) = @desired_id;

+---+-+-+-+
| os_id | os_name | os_code | solution|
+---+-+-+-+
| 8 | win nt  |  24 | nt and 2000 dun fix |
| 8 | win nt  | 255 | no-pay contact CSRs |
+---+-+-+-+
2 rows in set (0.01 sec)


-- 
 
Jeff Shapiro | Starlight Spectacular Ride
Webmaster| June 21st,2003 at midnight
www.starlightspectacular.org | Benefiting the Trails  Open Space Coalition

On 4/2/03 at 15:40, John Hoskins spoke thusly:

This one worked. Thank you.

On Wed, 2 Apr 2003, Michael Shulman wrote:

 John,
 
 Looks like I'm first with the wrong answer again.
 
 This time for sure.
 
 How about:
AND os.os_id  8 = 8
 
 Where 8 is the value that you're looking for.
 
 -ms
 
 
 
 
 -Original Message-
 From: Michael Shulman [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, April 02, 2003 11:38 AM
 To: 'John Hoskins'
 Cc: '[EMAIL PROTECTED]'
 Subject: RE: select help
 
 No problem. Use mod(m,n). To get the records where the 8 bit is set, use 
and mod(os.os_id,8) = 0;
 
 mysql use test
 Database changed
 mysql create table t (i integer);
 Query OK, 0 rows affected (0.18 sec)
 
 mysql insert into t values (1);
 Query OK, 1 row affected (0.10 sec)
 
 mysql insert into t values (2);
 Query OK, 1 row affected (0.00 sec)
 
 rows omitted for brevity, values 3..7 inserted
 
 mysql insert into t values (8);
 Query OK, 1 row affected (0.00 sec)
 
 mysql select * from t where mod(i,2) = 0;
 +--+
 | i|
 +--+
 |2 |
 |4 |
 |6 |
 |8 |
 +--+
 4 rows in set (0.00 sec)
 
 mysql select * from t where mod(i,4) = 0;
 +--+
 | i|
 +--+
 |4 |
 |8 |
 +--+
 2 rows in set (0.00 sec)
 
 -Original Message-
 From: John Hoskins [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, April 02, 2003 11:34 AM
 To: Michael Shulman
 Cc: [EMAIL PROTECTED]
 Subject: RE: select help
 
 Not quite that simple, Plese read the last of the original post. I need 
 all solutions that have the 4th bit on, so 8,15,24,31...255 all have the 
 4th bit in combination with other bits.
 
 On Wed, 2 Apr 2003, Michael Shulman wrote:
 
  mysql select solution
  - from os_table os, solutions_table solutions
  - where os.os_id = solutions.os_code
  - and os.os_id = 8;
  
  -ms
  
  
  -Original Message-
  From: John Hoskins [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, April 02, 2003 10:41 AM
  To: [EMAIL PROTECTED]
  Subject: select help
  
  
  Please consider the following two tables:
  
  mysql select * from os_table;
  +---+--+
  | os_id | os_name  |
  +---+--+
  | 1 | mac os   |
  | 2 | win 95   |
  | 4 | win 98   |
  | 8 | win nt   |
  |16 | win 2000 |
  |32 | win me   |
  |64 | xp home  |
  |   128 | xp pro   |
  +---+--+
  
  mysql select * from solution_table;
  +-+-+
  | os_code | solution|
  +-+-+
  |   1 | mac fix |
  |  24 | nt and 2000 dun fix |
  | 255 | no-pay contact CSRs |
  +-+-+
  
  
  What I'd like to do is select all solutions that 
  applys to  NT, os_id.os_table=8
  
  so it should return solution 24 and 255. Since these two solutions have
  the NT os bit turned on.
  
  Thank You
  John H.
  
  
  
  
 
 
 
 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: get the table name from a field for 3 different tables

2003-03-27 Thread Jeff Shapiro
At 15:40 +1100 3/28/03, Daniel Rossi wrote:
hi there i would like to find out how to get the table from a field 
if i am joining three tables together for instance  select a.id, 
b.id, c.id from a, b, c

when i get the results i need to be able to get the table name a if 
i get the result from a.id , is it possible ?
The first thing that comes to mind is to do:

SELECT a.id AS table_a_id, b.id AS table_b_id, c.id AS table_c_id FROM a, b, c

or something like that.

There may be more elegant ways, but I haven't be using MySQL that long. gr

jeff

--
_   ____ +--+
   / | / /__    _/ /_   _|Jeff Shapiro  |
  /  |/ / _ \/ __ \/ ___/ __ \/ __ `/|Photography and Graphic Design|
 / /|  /  __/ / / (__  ) / / / /_/ / |Colorado Springs, CO, USA |
/_/ |_/\___/_/ /_//_/ /_/\__,_/  |www.nensha.com ||| [EMAIL PROTECTED]|
 +--+
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Formatting timestamp in MySQL outfile

2003-03-26 Thread Jeff Shapiro
You should be able to use DATE_FORMAT to format the TIMESTAMP anyway you need.

Check out DATE_FORMAT at:
http://www.mysql.com/doc/en/Date_and_time_functions.html
At 20:01 +0530 3/26/03, anirudha kukreti wrote:
hi everybody,

i would like to know, if there exists a method for getting a format like

'2003-12-31 12:00:00' for the time stamp

in the text file generated using the outfile command.

the normal format is '2003123112'

any help would be greatly appreciated.

Thanks in advance
anirudh
Filter guard: sql,query



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Foreign Key

2003-03-24 Thread Jeff Shapiro
Here's info about the error code:
Error code 150:  Unknown error: 150
150 = Foreign key constraint is incorrectly formed
Here's info on InnoDB foreign keys:
http://www.mysql.com/doc/en/SEC459.html
At 16:33 + 3/24/03, Luis Matos Lima wrote:
i´m having some trouble in creating a table like this
one.
CREATE TABLE tab3(
cod1 int( 3 ) NOT NULL ,
cod2 int( 3 ) NOT NULL ,
PRIMARY KEY ( cod1, cod2 ) ,
FOREIGN KEY ( cod1 ) REFERENCES tab1( cod1 ) ON UPDATE
CASCADE ON DELETE CASCADE ,
FOREIGN KEY ( cod2 ) REFERENCES tab2( cod2 ) ON UPDATE
CASCADE ON DELETE CASCADE
) TYPE = INNODB
I don´t understand why i acannot create it.
I´m using mysql 4.0.12 in win98 wiht phpmyadmin 2.2.4
i receive a message error like this
Mensagens do MySQL :
Can't create table '.\test\tab3.frm' (errno: 150)
Please help, i´m in a important project and i need to
know how to slove this problem.


-
Email Enviado utilizando o serviço MegaMail
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: PHP before mysql on a mac?

2003-03-24 Thread Jeff Shapiro
Here's a couple of links that should help.

PHPMac
http://www.phpmac.com/
has an article about turning on PHP in Apache.
MySQL on Mac OS X
http://developer.apple.com/internet/macosx/osdb.html
PHP on Mac OS X
http://developer.apple.com/internet/macosx/php.html
Even though OS X comes with Apache and PHP installed, for some reason 
Apache is not configured to handle PHP by default (at least in 
Jaguar). You have to make changes to your httpd.conf file.

jeff

At 9:23 -0800 3/24/03, katherine bjork wrote:
My test.php page recognizes the potential for mysql but something went
wrong when I first tried to install mysql so I removed mysql and am
about to attempt a re-install.
I've a couple of books on hand, neither of which addresses MAC OSX
which is unix based.
OSX comes with apache and php pre-installed but the books I read state
that mysql must be installed before php unless php expects it to be
installed in a specific location and it is thus installed in said
location.
I'm a complete novice on all accounts once I install Mysql, how do I
get php to see it?
Katherine

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Mysqld problem

2003-03-23 Thread Jeff Shapiro
It looks to me like you have a permissions problem with your 
directories. You need to make sure that the directory own for the 
mysql directory tree is your mysql user.

You can't use the Users section of Systems Preferences to create the 
MySQL user, you have to use the NetInfo utility.  Apple as 
instructions on how to install MySQL on OS X at:
http://developer.apple.com/internet/macosx/osdb.html

Hmmm, just checked Marc Liyanage's site and for pre-Jaguar he does 
mention to use System Preferences to create the MySQL user. He also 
only suggests to use 3.23.51 with pre-Jaguar as well. I'm not what 
the differences might be between the .51 and .55 for him to make this 
suggestion. I did try using his setup, but I gave up and went with 
the tarball files from MySQL instead. I didn't like all the 
nonstandard stuff that his system did. (At least I think it does some 
nonstandard stuff, it's been a while).

I just checked your error code with:
[~] [0]  perror 13
Error code  13:  Permission denied
So it definitely looks like it's a permissions problem.

Try using this command in the Terminal program:

chown -R mysql /usr/local/mysql-3.23.51/



At 13:09 + 3/23/03, Phil Dobbin wrote:
I'm having a problem starting the mysqld. I'm running 3.23.51 on Mac OS X
10.1.5 and have a startup script which confirms on boot that it has started
but doesn't.
I've tried starting manually from the CLI but no luck. I looked in
localhost.err and found:
030323  9:48:21  /usr/local/mysql-3.23.51/bin/mysqld: Can't create/write to
file '/usr/local/mysql-3.23.51/data/localhost.pid' (Errcode: 13)
030323  9:48:22  /usr/local/mysql-3.23.51/bin/mysqld: Can't find file:
'./mysql/host.frm' (errno: 13)
030323  9:48:22  /usr/local/mysql-3.23.51/bin/mysqld: Error on delete of
'/usr/local/mysql-3.23.51/data/localhost.pid' (Errcode: 13)
030323 09:48:22  mysqld ended
According to the O'Reilly `MySQL Reference Manual' it seems that the daemon
may have been damaged but offers no real clue as how to fix it.
One other very odd aspect is that on OS X you create a mysql user in Sys
Prefs and I noticed, upon reboot, that this user had disappeared from the
pref panel. I re-created but to no avail.
Any help at all on this would be gratefully appreciated.

Regards,

Phil.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: Using LIKE to search for occurence of a column value in a string

2003-03-23 Thread Jeff Shapiro
The reason that what you are doing isn't working is because you are 
trying to find a really long string in a short string. You need to 
reverse your string searching.

Try:

SELECT URL, Name
FROM websites
WHERE LOCATE(URL, 
'http://www.microsoft.com/kb/knowledgeb.asp?id=3strse=12')  0;

Here's some other functions that might be of interest:
LOCATE(substr,str)
POSITION(substr IN str)
Returns the position of the first occurrence of substring substr in 
string str . Returns 0 if substr is not in str :
mysql SELECT LOCATE('bar', 'foobarbar');
- 4
mysql SELECT LOCATE('xbar', 'foobar');
- 0
This function is multi-byte safe.  In MySQL 3.23 this function is 
case sensitive, while in 4.0 it's only case-sensitive if either 
argument is a binary string.
LOCATE(substr,str,pos)
Returns the position of the first occurrence of substring substr in 
string str , starting at position pos . Returns 0if substr is not in 
str :
mysql SELECT LOCATE('bar', 'foobarbar',5);
- 7
This function is multi-byte safe.  In MySQL 3.23 this function is 
case sensitive, while in 4.0 it's only case-sensitive if either 
argument is a binary string.
INSTR(str,substr)
Returns the position of the first occurrence of substring substr in 
string str . This is the same as the two-argument form of LOCATE() , 
except that the arguments are swapped:
mysql SELECT INSTR('foobarbar', 'bar');
- 4
mysql SELECT INSTR('xbar', 'foobar');
- 0
This function is multi-byte safe.  In MySQL 3.23 this function is 
case sensitive, while in 4.0 it's only case-sensitive if either 
argument is a binary string.

At 20:07 +0200 3/23/03, Ville Mattila wrote:
 I tried to use LIKE:
 SELECT URL, Name
 FROM websites
 WHERE 'http://www.microsoft.com/kb/knowledgeb.asp?id=3strse=12'
 LIKE (URL + '%');
 But this doesn't return any results. I would like the following as output:
 'http://www.microsoft.com/kb/' Microsoft Knowledgebase
Hi!

How about the following?

SELECT URL, Name FROM websites WHERE
'http://www.microsoft.com/kb/knowledgeb.asp?id=3strse=12' LIKE CONCAT(URL,
'%');
- Ville




--
_   ____ +--+
   / | / /__    _/ /_   _|Jeff Shapiro  |
  /  |/ / _ \/ __ \/ ___/ __ \/ __ `/|Photography and Graphic Design|
 / /|  /  __/ / / (__  ) / / / /_/ / |Colorado Springs, CO, USA |
/_/ |_/\___/_/ /_//_/ /_/\__,_/  |www.nensha.com ||| [EMAIL PROTECTED]|
 +--+
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: upgrading mysql

2003-03-21 Thread Jeff Shapiro
These links may help:
2.5.2 Upgrading From Version 3.23 to Version 4.0
http://www.mysql.com/doc/en/Upgrading-from-3.23.html
2.1.1 Installing MySQL on Linux
http://www.mysql.com/doc/en/Linux-RPM.html
2.6.1.1 Linux Notes for Binary Distributions
http://www.mysql.com/doc/en/Binary_notes-Linux.html
2.2 General Installation Issues
http://www.mysql.com/doc/en/General_Installation_Issues.html
At 16:59 -0500 3/21/03, [EMAIL PROTECTED] wrote:
Thank you for your reply.  OK, I understand that.  So what are the 
steps to install the file.  Isn't there an RPM or something.  Do I 
take the 4.0 binary and place it an any folder on my box?  Then go 
to that directory and type a lynix command to unpack and install the 
files?  Then, go to the config file (not sure which one), maybe the 
one in my database and point it to the new mqsql program?
I relly appreciate your help.

Thanks,
Mike
The following message was sent by Jennifer Goodie 
[EMAIL PROTECTED] on Fri, 21 Mar 2003 14:36:43 -0800.

 On a linux box you do not have to stop everything like on Windows.  We
 always leave our current version running, install the upgrade in a new
 location with a new data dir (a snapshot of the live one).  We run the
 new
 install on a different port than the live install so we can test it and
 what
 not before switching over.  We always leave our installs in a directory
 that
 gives the version info like mysql-3.23.55-pc-linux-i686 and then symlink
 a
 directory named mysql to the version that should be live.  So when we decide
 it is time to go live with the new install we change the conf to point
 to
 the correct data dir and to be on the right port, stop mysqld, change the
 symlink and then restart with the new version.  This allows for easy
 rollbacks just in case.
 We have had really poor luck with building from source on our VA Linux
 box
 and have used the binaries for the last two or three upgrades.  Our builds
 were really unstable and buggy under a high load, but the binaries have
 been
 great.
 Hope that helps

 -Original Message-
 From: Tab Alleman [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 21, 2003 2:14 PM
 To: [EMAIL PROTECTED]
 Subject: RE: upgrading mysql
 [EMAIL PROTECTED] wrote:
   Can someone help
  point me in the right direction? Thanks
 I just finished a practice upgrade (on a back-up server) myself and will
 be upgrading the real server during off-peak hours soon.  We are running
 win2k servers so I can't speak directly to any linux issues, but
 generically speaking, upgrading to 3.23.56 was easy:  I downloaded the
 installation files to my server and unzipped them.  Stopped the MySQL
 service AND mysqladmin (you will have errors if you don't do this!).
 Then ran the setup.exe, restarted the service, checked mysql admin and
 saw that the version had been updated, and smiled.  I would imagine if
 you follow the corresponding linux-steps, you should have no problems.
 Good luck,
 Tab
 mysql

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Re: appending to longtext field

2003-03-19 Thread Jeff Shapiro
At 1:50 + 3/20/03, Mr Orange wrote:
GV wrote:
 I think is better to have an additional record each time a user
 inserts
 new information
 Mr Orange wrote:
 Hello all,

 I have a database with a type longtext called notes.

 Say I wanted to append some text to this field, what command would I
 use?
 I have tried the following sql..
   update clients set notes=notes+text to append where id=1;
 But this doesn't seem to do the job.

 I am new to MySQL so sorry if I've asked an obvious question!

 Many thanks in advance,

 Steve.

 PS.  What is needed is a database to store notes on each client
 which can be added to as necessary.  If anyone has a better idea of
 a way to do this, I'd be very grateful for any help!  Cheers.
Hi GV,

What do you mean by adding an additional record?

At the moment, say I have a table set up as follows:
  id int(6) not null auto_increment,
  notes longtext,
I have no idea at the beginning how many notes a user will enter on a
particular client, so how would I create the table?  Obviously I
couldn't have,
  int int(6) not null auto_increment,
  note1 longtext,
  note2 longtext, etc.
Is it possible to create a 'dynamic' table where the fields in there could
grow to accomodate any inputted notes?
If you could offer any help on this, by way of email, or links to webpages
or whatever, I'd be really grateful,
Cheers,

Mr O.
I think what GV is suggesting is that every time a user adds a note 
to your system, you use the INSERT INTO ... command to add a new 
record into the database. I would add a timestamp column so that you 
can sort the notes by their order of entry (of course there are 
several other ways to accomplish this as well). Actually, this is 
probably the best way to handle the set up. You mention that these 
notes are being entered for a particular client. I assume that you 
also have a client table as well as the notes table. This is an ideal 
situation for a parent/child table relational set up (or one-to-many 
relationship). When you need notes for a particular client, you 
SELECT on the client identifier in the notes table and you will have 
a listing of the all notes for the client.

Here's basically the set up that I would use:

Parent table: (the client information)
--
client_id   int(6) not null auto_increment,
name, address, and all the other important client contact stuff
Child table: (the note information)

note_id int(6) not null auto_increment,
client_id   int(6),
entry_date  timestamp,
notelongtext,
index   idx_client_id (client_id),  === you may not need this index
foreign key references client_table (client_id)
Of course to use the foreign keys you will need to use InnoDB table type.

With this type of set up, a client may have anything from 0 to your 
free hard disc space of notes.

I'm sure that if I made some glaring error here, some one will point 
it out and correct me (which I woudl greatly appreciate :-).

Back to your original question:

You didn't mention what you are using to access MySQL. PHP? C++? Perl?

If I *really*, *really* wanted to keep only one note record for each 
client (or to have the notes in the client table), I would create an 
update form and populate the form with the proper client 
information and use the my language's functions to concatenate the 
old and new information. After that use an UPDATE statement to 
replace the existing note with the new note.

Depending on what type of system you are creating, doing this 
update method may bring in all kinds of headaches down the road. 
You may get people trying to change information that some one else 
put in the tables.

The best way to go is the parent/child relationship.

just my $0.02.
jeff
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Re: Help with Query

2003-03-18 Thread Jeff Shapiro
OK, attempt number two:

Let's see what you are after is the number of emails that a member 
has received (say 25), and then you also want the number of members 
that have received x-number (say 25) emails. Is this even close to 
what you want?

I think the only way to answer the question(s) is to use more than 
one query (specially since MySQL doesn't support sub-selects).

Here's what I came up with: (it's probably not pretty and more than 
likely not completely correct, but I haven't been playing with MySQL 
than long).

CREATE TEMPORARY TABLE member_counts
SELECT member_id, COUNT(mailing_id) AS mail_count FROM member_mailings
GROUP BY member_id;
This puts the number of mailings into a temp table.

Now we do:

SELECT mail_count, COUNT(member_id) FROM member_counts
GROUP BY mail_count;
I *think* that these to step should give you what you are after.

jeff

At 22:47 -0800 3/17/03, Daren Cotter wrote:
This seems to be doing the same thing as the
previously mentioned query...simply listing all
mailing IDs, along with the # of members it was sent
to. I've included both queries with their results
below.
mysql SELECT COUNT(member_id), COUNT(mailing_id) FROM
member_mailings GROUP BY mailing_id;
+--+---+
| COUNT(member_id) | COUNT(mailing_id) |
+--+---+
|1 | 1 |
|25000 | 25000 |
|1 | 1 |
|25000 | 25000 |
|53855 | 53855 |
|53897 | 53897 |
|53247 | 53247 |
|15000 | 15000 |
|1 | 1 |
|1 | 1 |
|   140901 |140901 |
|1 | 1 |
+--+---+
12 rows in set (0.57 sec)
mysql select mailing_id, count(*) from
member_mailings group by mailing_id;
++--+
| mailing_id | count(*) |
++--+
|  1 |1 |
|  2 |25000 |
|  3 |1 |
|  4 |25000 |
|  6 |53855 |
|  7 |53897 |
|  8 |53247 |
| 11 |15000 |
| 12 |1 |
| 13 |1 |
| 15 |   140901 |
| 16 |1 |
++--+
12 rows in set (0.56 sec)
--- Zak Greant [EMAIL PROTECTED] wrote:
 On Mon, Mar 17, 2003 at 09:52:44PM -0800, Daren
 Cotter wrote:
  Jeff,
 
  That query simply gives me each mailing ID, along
 with
  the # of members associated with that mailing ID.
 
  What I NEED is to return the # of mailings sent to
 a
  member, and the number of members associated with
 that
  number.
 
  I.e., if I do:
 
  SELECT count(*) FROM member_mailings WHERE
 member_id =
  1
 
  That returns the number of mailings for member 1,
 say
  it's 25. That would be one tally in the 25 field
 for
  # of mailings sent.
 
  It's tough to explain, so I'm thinking I won't be
 able
  to accomplish it in one query?
   Hello Daren,

   Assuming that your table looks something like
 this:
   +-+---+-+-+
   | ... | member_id | mail_id | ... |
   +-+---+-+-+
   | ... | 1 |   1 | ... |
   | ... | 2 |   1 | ... |
   | ... | 3 |   1 | ... |
   | ... | 1 |   2 | ... |
   | ... | 2 |   2 | ... |
   | ... | 3 |   3 | ... |
   +-+---+-+-+
   Then this query should return the information that
 you desire:
   SELECT COUNT(member_id), COUNT(mail_id)
FROM member_mailings
GROUP BY mail_id;
   Cheers!
   --
   Zak Greant
   MySQL AB Community Advocate

-
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list
 archive)
 To request this thread, e-mail
 [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try:
 http://lists.mysql.com/php/unsubscribe.php


__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive

Re: Help with Query

2003-03-17 Thread Jeff Shapiro
This should get you close:

SELECT mail_id, count(member_id) AS `# of members` FROM yourtable
GROUP BY mail_id;
At 18:44 -0800 3/17/03, Daren Cotter wrote:
I have a table that keeps track of when members of my
site are mailed. The important fields in the table
are: member_id, mail_id
I need to write a query that will return the # of
members and # of mailings, like the table below:
# of mailings sent # of members
---
1  10,000
2  20,000
......
Meaning, there are 10,000 members that have been sent
1 mailing, and 20,000 members that have been sent 2
mailings.
Is this possible in one query?

TIA,

Daren


--
_   ____ +--+
   / | / /__    _/ /_   _|Jeff Shapiro  |
  /  |/ / _ \/ __ \/ ___/ __ \/ __ `/|Photography and Graphic Design|
 / /|  /  __/ / / (__  ) / / / /_/ / |Colorado Springs, CO, USA |
/_/ |_/\___/_/ /_//_/ /_/\__,_/  |www.nensha.com ||| [EMAIL PROTECTED]|
 +--+
-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Re: Selecting from mySql database regarding dates

2003-03-03 Thread Jeff Shapiro
Here's how I would do it. (I'm sure that you'll probably get other 
solutions as well.)

 $query = SELECT * FROM designs, appliquetable, puffyfoamtable WHERE
designs.puffyfoam = puffyfoamtable.puffyfoam AND
designs.applique = appliquetable.applique AND
  TO_DAYS(NOW()) - TO_DAYS(designs.designadddate) = 14
GROUP BY catcode
ORDER BY designfile;
That is unless you are allowing people to enter future dates in the 
tables. Unless there is a good reason, I generally have error 
routines prevent future dates into the table.

jeff

At 13:01 -0500 3/3/03, Stitchin' wrote:
I have a column in my mySql database that holds a date that I've added each
record called
designadddate

I'm trying to create a filter to only pull up the records that have been
added over the last two weeks. This is my code ... I added the echo for the
$today and $twoweeksago variables to make sure something was being
calculated, they are showing up correct as 2003-03-03 and 2003-02-17 ... but
it isn't pulling up any records -- it's not bombing out and giving me the
Couldn't execute query message - but I know there's three records that I
made sure had dates in between this range.  I also tried using BETWEEN and
it didn't seem to work either.

  $today = date (Y-m-d);
  $twoweeksago = date(Y-m-d,mktime(0,0,0,date(m), date(d)-14, date(Y)));
echo$today\n;
echo$twoweeksago\n;
  /* Select designs of the given type */
  $query = SELECT * FROM designs, appliquetable, puffyfoamtable WHERE
designs.puffyfoam = puffyfoamtable.puffyfoam AND
designs.applique = appliquetable.applique AND
   (designs.designadddate = $today AND
designs.designadddate = $twoweeksago)GROUP BY
catcode ORDER BY designfile;
  $result = mysql_query($query)
   or die (Couldn't execute query.);

Any help would me much appreciated!

TIA
Renee Toth


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Re: Remove -?

2003-03-03 Thread Jeff Shapiro
Try : (on a test table first of course)

UPDATE prodtable SET ProKeywords = REPLACE(ProdID, '-', '');

You may want to look at this page:
http://www.mysql.com/doc/en/String_functions.html
jeff

At 11:57 -0600 3/3/03, Doug Coning wrote:
Hi all,

I want to take the data in a column, modify and then set it into another
column.  In specific, I want to remove the dash from our Product ID column
and place it in another column without the dash.
For instance, a ProdID may be 'SK-22'.  I want to take this value from
ProdID and place it as 'SK22' into ProdKeywords column for the same record.
How would I go about removing the '-' and placing the remainder in the
ProdKeywords column.
Thank you,

Doug Coning
sql,query,queries,smallint


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Re: Scripting MySQL Commands

2003-03-02 Thread Jeff Shapiro
I'm fairly new to MySQL as well (although, I do have experience with Oracle).

Even though you create a new database doesn't mean that MySQL will 
automatically start using that database. After all you might want to 
create 10 or 15 databases all at once (why? I don't know), then start 
creating tables for the 5th one you created.

So your script needs to do something like:

create database 'Temp';
use 'Temp';
(You need the quotes [or maybe it's the backquotes] if you actually 
want a mixed case name.)

I'm sure that if I'm off, someone here will correct me.

jeff

At 12:27 -0500 3/2/03, Stephen Tiano wrote:
Paul, Oliver--

I really, really appreciate you guys taking time from your 
respective Sundays to try and enlighten me. But I'm still getting 
nowhere fast.

I've gotten it to this:

I open a new shell and type:

  /usr/local/bin/mysql --local-infile -u root -p [the full pathname 
up to]/Temp.sql

at which point it informs me incorrect database name. Well, yes, 
the script is to create a nonexistent database and then a table 
called Temp in that database.

I'm now officially lost. 'use' would only apply to an existing database.

By the way, I've also tried:

  /usr/local/bin/mysql -u root -p [the full pathname up to]/Temp.sql

to no avail.

S frustrating ...

Steve Tiano

-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Re: # of Business Days?

2003-02-24 Thread Jeff Shapiro
Here's a link to a solution that Oracle came up with:
http://dco-proxima.dco.pima.edu/oracle/tfts/PRE00136.HTM
You should be able to adapt it to MySQL and PHP (or whatever language 
you are using).
Basically, the script gets the start date and end date, then steps 
through every day counting only business week days.

Of course, and another question to consider, is if you wish to count 
holidays or not.

jeff

At 12:58 -0500 2/24/03, Lucas Cowgar wrote:
Can anyone out there help me with a SQL query? I need to find the number of
business days between date a and b? Obviously finding simply the number of
days is easy, but I have no clue how to find the number of business days.
TIA!
Lucas Cowgar
Information Technologies Department
Eldorado Services Group Inc.
http://www.eldoserv.com
[EMAIL PROTECTED]
(330) 861-3009
All your base are belong to us
--
_   ____ +--+
   / | / /__    _/ /_   _|Jeff Shapiro  |
  /  |/ / _ \/ __ \/ ___/ __ \/ __ `/|Photography and Graphic Design|
 / /|  /  __/ / / (__  ) / / / /_/ / |Colorado Springs, CO, USA |
/_/ |_/\___/_/ /_//_/ /_/\__,_/  |www.nensha.com ||| [EMAIL PROTECTED]|
 +--+
-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Re: Help to install Mysql on Macos X 10.2

2003-02-23 Thread Jeff Shapiro
My guess is that you don't have the developer's tools loaded on your
machine, or that there is something wrong with their configuration.
You may want to try using Aaron Faby's Complete MySQL. It uses the
Apple Installer to install MySQL 3.23.55. (That is double click on a
installer package and follow the instructions.)
Complete MySQL is available here:
http://www.aaronfaby.com/mysql.php
Complete MySQL should work for you unless you need some unusual
settings (which from your ./configure command it doesn't look like
you're using).
I hope this helps.
jeff
At 11:30 -0500 2/23/03, [EMAIL PROTECTED] wrote:
I'm trying to install Mysql in Macos X 10.2 following the quick install
steps. I'm a pro in the Unix command line and the configure command show
this error in the configuration:
[Akira:~/mysql-3.23.53] jeffreys% ./configure --prefix=/usr/local/mysql
checking build system type... powerpc-apple-darwin6.0
checking host system type... powerpc-apple-darwin6.0
checking target system type... powerpc-apple-darwin6.0
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... (cached) yes
checking for mawk... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking for gcc... no
checking for cc... cc
checking for C compiler default output... configure: error: C compiler
cannot create executables
I already have tryed to install Mysql in other Macos X machine and show me
another kind of error, that error says that CC file couldn't be found,
I'll be very happy if you can help me with tis problems.
Sorry for the bad english:

Jeffrey Salas


mail2web ? Compruebe el correo electrÛnico desde la web en
http://mail2web.com/ .


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php