Join question

2008-07-31 Thread Andrej Kastrin
Dear all, I have two tables,let's call then a and b: Table a: CUI1|CUI2 C001|C002 C002|C003 C003|C055 C004|C002 ... Table b: CUI|STY C001|T001 C002|T002 C003|T003 C004|T004 C005|T006 C055|T061 .. And the join table should be: T001|T002 T002|T003 T003|T061 T004|T002 ... So,I should convert

Re: COUNT returned rows of a SELECT

2008-07-31 Thread Rob Wultsch
On Wed, Jul 30, 2008 at 9:41 PM, Fish Kungfu [EMAIL PROTECTED] wrote: Using MySQL commands only (not PHP's mysql_num_rows), is there a way to COUNT the number of rows returned from a SELECT.GROUP BY? My primary SELECT query is this: SELECT aviName,MAX(dateTime) FROM aviTrackerMain WHERE

Re: Re-arranging fields

2008-07-31 Thread Rob Wultsch
On Wed, Jul 30, 2008 at 12:56 PM, Rob Wultsch [EMAIL PROTECTED] wrote: On Wed, Jul 30, 2008 at 11:42 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: Is there any reasonable way of re-arranging the order of columns in a table without losing their data? The best I could come up with was to copy the

Re: COUNT returned rows of a SELECT

2008-07-31 Thread Fish Kungfu
Thanks for trying guys, but that's still not quite what I'm looking for. All I really want is the total number of rows returned for the query result. For example, my the SELECT that Ananda suggested returns this: mysql SELECT aviName,MAX(dateTime) ,count(*) FROM aviTrackerMain WHERE

Re: Join question

2008-07-31 Thread Jigal van Hemert
Dear all, I have two tables,let's call then a and b: Table a: CUI1|CUI2 C001|C002 C002|C003 C003|C055 C004|C002 ... Table b: CUI|STY C001|T001 C002|T002 C003|T003 C004|T004 C005|T006 C055|T061 .. And the join table should be: T001|T002 T002|T003 T003|T061 T004|T002

SET vs. ENUM

2008-07-31 Thread Jerry Schwartz
Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341

Re: SET vs. ENUM

2008-07-31 Thread Martijn Tonies
Jerry, Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? Well, they are -different things- ... SETs shouldn't be used at all, IMO. ENUM can be somewhat useful, I guess. Martijn Tonies Database Workbench -

RE: Re-arranging fields

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Ranjeet Walunj [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2008 3:55 PM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: Re-arranging fields Jerry Schwartz wrote: Is there any reasonable way of re-arranging the order of columns in a table

RE: Re-arranging fields

2008-07-31 Thread Mr. Shawn H. Corey
On Thu, 2008-07-31 at 09:56 -0400, Jerry Schwartz wrote: [JS] I added a dozen or so columns for a special purpose, and although MySQL doesn't care I wanted them in a certain order that would be intuitive to a user / programmer. Why is a user looking at your database? This is a security

RE: Re-arranging fields

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Rob Wultsch [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2008 3:56 PM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: Re-arranging fields Something like ALTER TABLE [TABLE] MODIFY [COLUMN] col_name column_definition [FIRST | AFTER col_name] shoudl

RE: Re-arranging fields

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2008 4:06 PM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: Re-arranging fields On Wed, 2008-07-30 at 14:42 -0400, Jerry Schwartz wrote: Is there any reasonable way of re-arranging

RE: COUNT returned rows of a SELECT

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Fish Kungfu [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 12:41 AM To: mysql@lists.mysql.com Subject: COUNT returned rows of a SELECT Using MySQL commands only (not PHP's mysql_num_rows), is there a way to COUNT the number of rows returned from a

RE: SET vs. ENUM

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Martijn Tonies [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 9:51 AM To: mysql@lists.mysql.com Subject: Re: SET vs. ENUM Jerry, Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over

RE: Re-arranging fields

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 10:02 AM To: Jerry Schwartz Cc: 'Ranjeet Walunj'; mysql@lists.mysql.com Subject: RE: Re-arranging fields On Thu, 2008-07-31 at 09:56 -0400, Jerry Schwartz wrote: [JS] I added a dozen or

Re: SET vs. ENUM

2008-07-31 Thread Martijn Tonies
Jerry, Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? Well, they are -different things- ... SETs shouldn't be used at all, IMO. [JS] Why? It goes against normalizing your data, that's why. You

Re: Re-arranging fields

2008-07-31 Thread Martijn Tonies
[JS] I added a dozen or so columns for a special purpose, and although MySQL doesn't care I wanted them in a certain order that would be intuitive to a user / programmer. Why is a user looking at your database? This is a security breach. Users should only have access thru

RE: Re-arranging fields

2008-07-31 Thread Mr. Shawn H. Corey
On Thu, 2008-07-31 at 10:24 -0400, Jerry Schwartz wrote: [JS] Users will have read-only access through MS Access, and have to filter on various fields. You're assuming that your users will never, ever be granted anything but read-access to only the data they suppose to have, either by accident

Re: SET vs. ENUM

2008-07-31 Thread Perrin Harkins
On Thu, Jul 31, 2008 at 9:46 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? The only use for ENUM is to make your data smaller. It offers no protection against

Re: SET vs. ENUM

2008-07-31 Thread Mr. Shawn H. Corey
On Thu, 2008-07-31 at 11:24 -0400, Perrin Harkins wrote: On Thu, Jul 31, 2008 at 9:46 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? The only use for ENUM is to

Re: SET vs. ENUM

2008-07-31 Thread Perrin Harkins
On Thu, Jul 31, 2008 at 11:38 AM, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote: I don't see how that can be; with ENUM the DB has to set aside enough bytes for the longest identifier. ENUMs are stored as integers. The only advantage of ENUM is that the data is in the same table; you don't have

Re: COUNT returned rows of a SELECT

2008-07-31 Thread Perrin Harkins
On Thu, Jul 31, 2008 at 8:00 AM, Fish Kungfu [EMAIL PROTECTED] wrote: Ideally, I was hoping COUNT() could work like this, BUT it doesn't of course: mysql SELECT COUNT(SELECT aviName,MAX(dateTime) ,count(*) FROM aviTrackerMain WHERE DATE(dateTime) LIKE CONCAT(DATE(NOW()),'%') GROUP BY

RE: SET vs. ENUM

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Martijn Tonies [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 10:32 AM To: mysql@lists.mysql.com Subject: Re: SET vs. ENUM Jerry, Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one

RE: Re-arranging fields

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Martijn Tonies [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 10:37 AM To: mysql@lists.mysql.com Subject: Re: Re-arranging fields [JS] I added a dozen or so columns for a special purpose, and although MySQL doesn't care I wanted them in a certain

RE: Re-arranging fields

2008-07-31 Thread Jerry Schwartz
-Original Message- From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 10:54 AM To: Jerry Schwartz Cc: 'Ranjeet Walunj'; mysql@lists.mysql.com Subject: RE: Re-arranging fields On Thu, 2008-07-31 at 10:24 -0400, Jerry Schwartz wrote: [JS] Users will have

RE: SET vs. ENUM

2008-07-31 Thread Jerry Schwartz
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Perrin Harkins Sent: Thursday, July 31, 2008 11:25 AM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: SET vs. ENUM On Thu, Jul 31, 2008 at 9:46 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: Other than the fact that an ENUM

Re: Errors of make install command

2008-07-31 Thread Joerg Bruehe
Hi ! Jittinan Suwanrueangsri wrote: Hi all If you know how to fix these problems please tell me. System details 1.OS=Linux localhost.localdomain 2.6.25-14.fc9.i686 #1 SMP Thu May 1 06:28:41 EDT 2008 i686 i686 i386 GNU/Linux 2.tar = tar (GNU tar) 1.19 3.gcc =gcc (GCC) 4.3.0 20080428 (Red Hat

Re: SET vs. ENUM

2008-07-31 Thread Chris W
Jerry Schwartz wrote: [JS] No, you've made several good points. My reasoning is that inexperienced folks using this table through MS Access don't generally understand enough about database design to create the necessary JOINs to do it right. Perhaps the trade-off is a bad one. My thought is

Re: COUNT returned rows of a SELECT

2008-07-31 Thread Fish Kungfu
Beautiful! That's exactly what I needed. Thanks, Roy mysql SELECT COUNT(*) FROM (SELECT aviName,MAX(dateTime) FROM aviTrackerMain WHERE DATE(dateTime) LIKE CONCAT(DATE(NOW()),'%') GROUP BY aviName) as T; +--+ | COUNT(*) | +--+ | 49 | +--+ 1 row in set (0.30 sec)

Lookup tables

2008-07-31 Thread Chris W
This is really a MySQL and php question since one of the two options require programming. Of course I don't think the result would be different in a different programming language. I use lookup tables a lot. I have had between 5 to 10 lookup tables for one table of data. Normally the

Re: SET vs. ENUM

2008-07-31 Thread Mr. Shawn H. Corey
On Thu, 2008-07-31 at 11:47 -0500, Chris W wrote: My thought is you should develop an application that will give your users the information they need with out direct access to the DB. My thought is, if a user doesn't have a solid understanding of at least 1st and 2nd normal form, and basic

Re: SET vs. ENUM

2008-07-31 Thread Chris W
Mr. Shawn H. Corey wrote: Actually, it's scarier to give access to people who know what they're doing. They're the ones who would know how to sabotage it. Access should only be granted to those who need it to do their jobs. Everyone else should be restricted to using a user interface with

Re: Lookup tables

2008-07-31 Thread Perrin Harkins
On Thu, Jul 31, 2008 at 12:59 PM, Chris W [EMAIL PROTECTED] wrote: So my question is, is doing that way better than making the query more complex with all the joins? If by better you mean faster then yes, it probably is marginally faster. It would be simpler to just use the actual values you