Re: Need help on EXPLAIN in rating queries

2006-08-01 Thread Aleksandar Bradaric
Hi, I am trying to JOIN 2 tables TBL1 and TBL2 on TBL1.fld_id = TBL2.fld_id . And finally I filter out the results that i need in the where clause using where TBL1.fld_col = 100; Running an EXPLAIN shows that it is an impossible where condition. This may be because there may be no rows

Re: Query Help for Loosely Couple Properties

2006-08-01 Thread Jay Pipes
On Tue, 2006-08-01 at 16:23 -0700, Robert DiFalco wrote: I have a table that contains properties that can be associated with any table whose primary key is a LONG. Lets say that there is just one kind of property. The table looks something like this: TABLE StringVal REF_ID BIGINT

Re: Please Help - Stored Procedure Issue

2006-06-28 Thread Jesse
@lists.mysql.com Sent: Tuesday, June 27, 2006 5:15 PM Subject: Re: Please Help - Stored Procedure Issue On Tuesday 27 June 2006 01:52 pm, Jesse wrote: @cInvNo replace all instances of this with just cInvNo. cInvNo is already declared as an OUT variable, and @cInvNo will be set to that value

Re: Please Help - Stored Procedure Issue

2006-06-27 Thread Chris White
On Tuesday 27 June 2006 01:52 pm, Jesse wrote: @cInvNo replace all instances of this with just cInvNo. cInvNo is already declared as an OUT variable, and @cInvNo will be set to that value when you run: CALL sp_GetNextInv(-1,@cInvNo); -- Chris White PHP Programmer/DBBD Interfuel -- MySQL

RE: Join help

2006-06-14 Thread Tim Lucia
You want a LEFT (OUTER) JOIN, which will return nulls for the columns if no match on the join expression. -Original Message- From: Paul Nowosielski [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 14, 2006 4:44 PM To: mysql@lists.mysql.com Subject: Join help Dear All, I'm working on a

Re: please help me.

2006-06-02 Thread Daniel da Veiga
On 6/2/06, yuan edit [EMAIL PROTECTED] wrote: my operating system is linux redhat 9.0. i am installing mysql 5.0.x binary distribution. Which edition is the most fit in the following editions? You notices most of those files are .asc and .md5 used to verify the integrity of the archive after

Re: Need help querying a database of polynomials

2006-06-01 Thread Michael Stassen
Lew E. Lefton wrote: Hi, I hope this is an appropriate place to ask this question, if you think it is better suited for another list/forum, please let me know. I have a table that looks like this: mysql select polynomial_id, term_id from polynomial; +---+-+ |

Re: please help optimize this query

2006-06-01 Thread Joseph Alotta
, 2006 12:25:50 PM CDT To: Joseph Alotta [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Subject: Re: please help optimize this query I'd start by looking at your schema.. Quite a lot of use of varchars... I'd suggest using chars (takes more space but processes faster).. Or even better, normalize

Re: Need help querying a database of polynomials

2006-05-31 Thread Peter Brawley
Lew, If I have another polynomial, say the sum of terms 1,3,4, and 5, how can I quickly search this database to see if it's already been stored? SELECT DISTINCT polynomial_id FROM polynomial p1 INNER JOIN polynomial p2 ON p1.term_id=1 AND p2.term_id=3 INNER JOIN polynomial p3 ON p2.term_id=3

Re: Need help querying a database of polynomials

2006-05-31 Thread Pooly
2006/5/31, Peter Brawley [EMAIL PROTECTED]: Lew, If I have another polynomial, say the sum of terms 1,3,4, and 5, how can I quickly search this database to see if it's already been stored? SELECT DISTINCT polynomial_id FROM polynomial p1 INNER JOIN polynomial p2 ON p1.term_id=1 AND

Re: please help optimize this query

2006-05-31 Thread DreamWerx
I'd start by looking at your schema.. Quite a lot of use of varchars... I'd suggest using chars (takes more space but processes faster).. Or even better, normalize the data so that you have a table for symbols that is linked to this table via an integer based foreign key. Also it seems wierd

Re: query help-multiple joins

2006-05-23 Thread Johan Höök
Hi, I guess you should be able to do something like: SELECT t1.term_id, t1.name, r.type_id, t2.term_id, t2.name FROM term t1 LEFT JOIN relationTerm r ON r.term_id1 = t1.term_id LEFT JOIN term t2 ON r.term_id2 = t2.term_id /Johan mel list_php skrev: Hi! I'm stuck with a join query 2

Re: query help-multiple joins

2006-05-23 Thread mel list_php
Perfect! I tried aliasing the field names but didn't think about the table, and was just stuck looking at that query without any idea... Thanks a lot for your help. melanie From: Johan Höök [EMAIL PROTECTED] To: mel list_php [EMAIL PROTECTED] CC: mysql@lists.mysql.com Subject: Re: query

Re: Need help with triggers

2006-05-15 Thread Martijn Tonies
Daevid, This is my first trigger I'm trying to write. I have two tables. 'stores' and 'zipcodes'. I want to automatically set the latitude and longitude of the store using it's zipcode lookup in the zipcode table. DELIMITER $$; DROP TRIGGER `store_coord`$$ create trigger `store_coord`

Re: Need help with prcedures

2006-05-15 Thread sheeri kritzer
You cannot get data out of a database if it's not in the database. If there's no data for a day, you cannot get 0 for that day, because the day does not exist in the database. You could make a calendar table, one row per day, and join it with a count to get 0 for the day. -Sheeri On 5/15/06,

Re: need help in updating old binary files to database slave

2006-05-15 Thread sheeri kritzer
I've had this same problem -- if the database loses connection at the same time the log file flushes, you need to SET MASTER_LOG_FILE and MASTER_LOG_POS again and restart. I believe this probably qualifies as a bug if you want to report it. The reason the slave isn't updating log5 is because

Re: Need help with procedure

2006-05-15 Thread Peter Brawley
Barry wrote: Hello everyone! snip I have a table with saved clicks by users. Now i want to draw a graph with a php extension. Problem is: if i let me show the clicks, one day is missing. Because on that day noone clicked on the link. I use this query: SELECT DATE(c_clicktime) AS clicktime,

RE: Need help with triggers

2006-05-15 Thread Daevid Vincent
This is my first trigger I'm trying to write. I have two tables. 'stores' and 'zipcodes'. I want to automatically set the latitude and longitude of the store using it's zipcode lookup in the zipcode table. DELIMITER $$; DROP TRIGGER `store_coord`$$ create trigger

RE: Need help with triggers

2006-05-15 Thread Quentin Bennett
May 2006 2:41 p.m. To: 'Martijn Tonies'; mysql@lists.mysql.com Subject: RE: Need help with triggers This is my first trigger I'm trying to write. I have two tables. 'stores' and 'zipcodes'. I want to automatically set the latitude and longitude of the store using it's zipcode lookup

Re: Need help with triggers

2006-05-15 Thread Peter Brawley
Daevid, This is my first trigger I'm trying to write. I have two tables. 'stores' and 'zipcodes'. I want to automatically set the latitude and longitude of the store using it's zipcode lookup in the zipcode table. DELIMITER $$; DROP TRIGGER `store_coord`$$ create trigger

Re: Need help in recreating .MYD files

2006-05-11 Thread Pradeep Chandru
hi, Just to add up i have read some where ( i assume in the mailing list only) that OS recognizes the file based on few codes added at the starting / ending of a file. So there are ways to create a MYD file through vi editor as well (this is not from the angle of restoring the data in that

Re: Need help in recreating .MYD files

2006-05-10 Thread balaraju mandala
*Ok Daniel,* ** * Thank you.* ** *regards,* *bala* **

Re: Need help in recreating .MYD files

2006-05-09 Thread Dilipkumar
Hi, please tell me the server uptime and also the master logs as show master logs; in mysql prompt. Yes u can restore data from the binlog if you have the binlogs. balaraju mandala wrote: Hi Dilip, it means i loosed the data, correct Dilip. is there any other way to gain that data, any

Re: Need help in recreating .MYD files

2006-05-09 Thread balaraju mandala
Hi Dilip, I got two binary logs in Server. I don't know how to find server uptime? mysql show master logs; +--+ | Log_name | +--+ | localhost-bin.08 | | localhost-bin.09 | +--+ 2 rows in set (0.00 sec) if i ask for

Re: Need help in recreating .MYD files

2006-05-09 Thread Daniel da Veiga
On 5/9/06, balaraju mandala [EMAIL PROTECTED] wrote: Hi Dilip, I got two binary logs in Server. I don't know how to find server uptime? mysql show master logs; +--+ | Log_name | +--+ | localhost-bin.08 | | localhost-bin.09 |

Re: Need help in recreating .MYD files

2006-05-09 Thread balaraju mandala
Thank you Daniel for reply. Just in curiocity i want ask u, how u r taking daily backups, just using 'mysqldump' or using any Tools. regards, bala

Re: Need help in recreating .MYD files

2006-05-09 Thread Daniel da Veiga
On 5/9/06, balaraju mandala [EMAIL PROTECTED] wrote: Thank you Daniel for reply. Just in curiocity i want ask u, how u r taking daily backups, just using 'mysqldump' or using any Tools. I'm using mysqldump plus bzip2 to compress data for about 2 years now. Tried many tools, mysqldump

Re: Need help in recreating .MYD files

2006-05-08 Thread Dilipkumar
Hi, If you have deleted .MYD files then truncate the table and restore it from the backup if yu have. MYD means your precious data which contains. balaraju mandala wrote: Dear Comunity, I need your help. I accidently deleted some '.MYD' files. I want to restore them, without stopping

Re: Need help in recreating .MYD files

2006-05-08 Thread balaraju mandala
Hi Dilip, it means i loosed the data, correct Dilip. is there any other way to gain that data, any binary logs etc? regards, bala

Re: Query Help

2006-05-01 Thread Gabriel PREDA
SELECT id, count(*) AS cnt FROM `table_name` GROUP BY id ORDER BY cnt DESC [ LIMIT 1 ] -- Gabriel PREDA Senior Web Developer

Re: Query Help

2006-05-01 Thread Robert Gehrig
Thanks that got it. Robert Gehrig Webmaster at www.gdbarri.com e-mail: [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: need help for my jointure

2006-04-27 Thread Patrick Aljord
On 4/26/06, Shawn Green [EMAIL PROTECTED] wrote: --- Patrick Aljord [EMAIL PROTECTED] wrote: On 4/26/06, Patrick Aljord [EMAIL PROTECTED] wrote: I have a table confs like this: id int 5 auto_increment primary key; conf text; and another table conf_ip like this: id int 5

Re: need help for my jointure

2006-04-26 Thread Shawn Green
--- Patrick Aljord [EMAIL PROTECTED] wrote: I have a table confs like this: id int 5 auto_increment primary key; conf text; and another table conf_ip like this: id int 5 auto_increment primary key; conf_id int 5; ==foreing key of confs ip varchar 150; I would like to select id,

Re: need help for my jointure

2006-04-26 Thread Patrick Aljord
On 4/26/06, Patrick Aljord [EMAIL PROTECTED] wrote: I have a table confs like this: id int 5 auto_increment primary key; conf text; and another table conf_ip like this: id int 5 auto_increment primary key; conf_id int 5; ==foreing key of confs ip varchar 150; ok, sorry all for not being

Re: need help for my jointure

2006-04-26 Thread Shawn Green
--- Patrick Aljord [EMAIL PROTECTED] wrote: On 4/26/06, Patrick Aljord [EMAIL PROTECTED] wrote: I have a table confs like this: id int 5 auto_increment primary key; conf text; and another table conf_ip like this: id int 5 auto_increment primary key; conf_id int 5; ==foreing key

Re: need help for my jointure

2006-04-25 Thread Rhino
First of all, I'm going to guess that English is not your first language and tell you that jointure is not the word normally to describe the process of combining two tables in a database: the word you want is joining. Second, there are many kinds of joins and you haven't specified which kind

Re: please help, can not delete database

2006-04-22 Thread Rhino
What makes you think the delete of the database failed? It looks like the message from the DROP command indicates that the database was dropped successfully. -- Rhino - Original Message - From: Randy Paries [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Saturday, April 22, 2006

Re: please help, can not delete database

2006-04-22 Thread John Hicks
Randy Paries wrote: Hello, Not sure what is going on i have mysql Ver 12.22 Distrib 4.0.17, I have a database that i can not delete. i do this #mysqladmin drop billmax -u admin --password Enter password: Dropping the database is potentially a very bad thing to do. Any data stored in the

Re: need help to delete duplicates

2006-04-17 Thread William Fong
Sample Data: ID-Row1-Row2 1-A-B 2-A-B Row1 and Row2 are duplicate, so you only want one. Which ID do you want? -will On 4/17/06, Patrick Aljord [EMAIL PROTECTED] wrote: hey all, I have a table mytable that looks like this: id tinyint primary key auto_increment row1 varchar 150 row2

Re: need help to delete duplicates

2006-04-17 Thread William Fong
If the ID doesn't represent anything, you can CREATE TABLE new_table SELECT DISTINCT Row1, Row2 FROM old_table And then recreate your index(es). All your autoincrement IDs will be changed. On 4/17/06, Patrick Aljord [EMAIL PROTECTED] wrote: On 4/18/06, William Fong [EMAIL PROTECTED] wrote:

Re: Query help with count and join on same table I think

2006-04-10 Thread Frank
2wsxdr5 wrote: I have a table of people. Some of the people in this table are related. You can find out who is related by comparing a familyID number. I have a query to select a certain group of people from the table and I want to also select anyone who is related to them, even though

Re: UDF help, convert BLOB to BIGINT

2006-03-22 Thread SGreen
David Godsey [EMAIL PROTECTED] wrote on 03/22/2006 01:21:07 PM: I'm in the process of writing my first UDF and would appreciate some help. I am pulling data from a table like: SELECT payload_time, SUBSTR(BINARY(frame_data), FLOOR(foffset/8)+1,

Re: UDF help, convert BLOB to BIGINT

2006-03-22 Thread David Godsey
Just figured it out without a UDF(not documented anywhere that I found). SELECT conv(hex(fdata),16,10) INTO fdata_bigint; So a double conversion seems to work for me. You solution looks like it will work, but since I was able to get it to work without a UDF, I'm not going to test it out.

Re: Please help: recovering db from crash

2006-03-21 Thread Mark Leith
This is actually for Linux/Unix, not Windows. What error do you get from MySQL when trying to log in? Does the mysqld(-nt) process show within Task Manager? What does the new error log say? You may need to reset permissions: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

Re: Please help: recovering db from crash

2006-03-21 Thread Adrian Bruce
not sure, but it may be worth trying the following run the script: mysql_install_db --user=root In the installation dir this should change ownership and make mysql recognise the data dir. good luck Ade Foo Ji-Haw wrote: Hi all, My Windows-based database server crashed (no fault of MySQL.

Re: Please help: recovering db from crash

2006-03-21 Thread Foo Ji-Haw
Thanks for coming to the rescue, Mark and Bruce. Mark Leith wrote: This is actually for Linux/Unix, not Windows. What error do you get from MySQL when trying to log in? Does the mysqld(-nt) process show within Task Manager? What does the new error log say? You may need to reset

Re: Query help

2006-03-12 Thread Peter Brawley
OKAN ARI wrote: I have 3 tables Table 1: user(id, name, surname) Table 2: crime(id, detail) Table 3: user_crime(id, user_id, crime_id) Table 1 1, OKAN, ARI Table 2 1, detail 1 2, Detail 2 Table 3 1, 1, 1 1, 1, 2 So user 1 takes 2 crime from crime table... I want to receive info with 1

Re: Need help with a Basic Query.

2006-03-09 Thread Peter Brawley
clint lenard wrote: Hey Guys, I was wondering if I could get some assistance with building a Simple Import Script using PHP and MySQL. Basically I'm trying to pull info out of one Table and Insert it into the other Table. Can anyone show me a simple example of this? I can figure out how to

RE: Need help with a Basic Query.

2006-03-08 Thread Nicolas Verhaeghe
That SQL 101. It's a basic INSERT / SELECT. http://dev.mysql.com/doc/refman/4.1/en/insert-select.html Scroll down for the examples. -Original Message- From: clint lenard [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 8:54 PM To: mysql@lists.mysql.com Subject: Need help with

Re: Need help with a Basic Query.

2006-03-08 Thread mysql
13.1.5.1. Silent Column Specification Changes CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [select_statement] ^^^ Regards Keith In theory, theory and practice are the same; In practice they are not. On

RE: Qyery help - pass string to stored procedure for IN clause - FIXED!

2006-03-03 Thread Price, Randall
-Original Message- From: Ing. Edwin Cruz [mailto:[EMAIL PROTECTED] Sent: Thursday, March 02, 2006 3:03 PM To: Price, Randall Subject: RE: Qyery help - pass string to stored procedure for IN clause What abaut this: CREATE PROCEDURE spGetNames (IN strNames VARCHAR(255)) BEGIN

Re: query help?

2006-02-23 Thread cnelson
I am a novice when it come to queries such as this and was hoping someone could help me write a query that tells me how many records have the same ID and vendor number. |ID| vendor_no| date| |2354 | 578 | 2005-12-23| |2355 | 334 |

RE: query help?

2006-02-23 Thread Andy Eastham
Richard, If you mean with _both_ the same id _and_ vendor id, try this: Select id, vendor_id, count(*) from tablename group by id, vendor_id; If you just want separate counts for id and vendor_id, use: Select id, count(*) from tablename group by id; Select vendor_id, count(*) from tablename

Re: query help?

2006-02-23 Thread Richard Reina
I's so sorry. You are very correct. The sample data is bad. ID should be unique. Here it is corrected. |ID| vendor_no| date| |2354 | 578 | 2005-12-23| |2355 | 334 | 2005-12-24| |2356 | 339 | 2005-12-26| |2357 | 339

Re: query help?

2006-02-23 Thread SGreen
If you are looking just for duplicate (ID,vendort_no) combinations, this will find them: SELECT ID, vendor_no, count(1) as dupes FROM table_name_here GROUP BY ID, vendor_no HAVING dupes 1; Shawn Green Database Administrator Unimin Corporation - Spruce Pine Richard Reina [EMAIL PROTECTED]

Re: query help?

2006-02-23 Thread Richard Reina
Actually I am looking for duplicates (vedor_no, date), but I think I can hopefully adapt the solution you have given me. [EMAIL PROTECTED] wrote: If you are looking just for duplicate (ID,vendort_no) combinations, this will find them: SELECT ID, vendor_no, count(1) as dupes FROM

Re: For help

2006-02-10 Thread sheeri kritzer
If you mean a slave that replicates more than one master, that is not possible -- ie, this is not possible: Master1 -- |-- Slave Master 2 - However, if you mean: Master 1 --- Master2 Then all you have to do is set up replication so Master2 is a slave

Re: Need help configuring INNODB (Customer is ready to sue)

2006-02-09 Thread Gary Richardson
What are the problems you've been experiencing? Did you convert all tables? How big is the database? On 2/9/06, Shaun Adams [EMAIL PROTECTED] wrote: I have a customer who has been in production for a few weeks now having converted from MyISM to INNODB. We have been experiencing a few problems

Re: Need help configuring INNODB (Customer is ready to sue)

2006-02-09 Thread Heikki Tuuri
Shaun, the my.cnf looks ok. You might be able to raise the InnoDB buffer pool size to 3G, but beware swapping. SHOW INNODB STATUS looks ok, though it would be more informative if it were taken during a typical workload. Free buffers 0 Having free buffers 0 is very normal. Buffers

Re: Query Help

2006-01-24 Thread gerald_clark
Ian Barnes wrote: Hi, This is my current query which works in mysql 4, but not in 5. Its from mambo, but im trying to modify it because they don't officially support mysql5 yet. The original query: SELECT c.*, g.name AS groupname, cc.name, u.name AS editor, f.content_id AS frontpage, s.title

RE: Query Help

2006-01-24 Thread Ian Barnes
, cc.title, c.ordering LIMIT 0,10; Thanks, Ian -Original Message- From: gerald_clark [mailto:[EMAIL PROTECTED] Sent: 24 January 2006 09:50 PM To: Ian Barnes Cc: mysql@lists.mysql.com Subject: Re: Query Help Ian Barnes wrote: Hi, This is my current query which works in mysql 4

RE: Query Help

2006-01-24 Thread SGreen
PM To: Ian Barnes Cc: mysql@lists.mysql.com Subject: Re: Query Help Ian Barnes wrote: Hi, This is my current query which works in mysql 4, but not in 5. Its from mambo, but im trying to modify it because they don't officially support mysql5 yet. The original query: SELECT c

Re: Query Help

2006-01-24 Thread Peter Brawley
Subject: Re: Query Help Ian Barnes wrote: Hi, This is my current query which works in mysql 4, but not in 5. Its from mambo, but im trying to modify it because they don't officially support mysql5 yet. The original query: SELECT c.*, g.name AS groupname, cc.name, u.name AS editor

Re: Need help with a query

2006-01-23 Thread Michael Stassen
Mark Phillips wrote: I am running mysql 4.0.24 on Debian sarge. I have a table with two columns, team and division, both varchar(255). There are some errors in the table where division has a value but team is blank. Given that I am getting new data, and the data entry folks may create a

Re: Need help with a query

2006-01-23 Thread Mark Phillips
On Monday 23 January 2006 03:33 pm, Michael Stassen wrote: Mark Phillips wrote: I am running mysql 4.0.24 on Debian sarge. I have a table with two columns, team and division, both varchar(255). There are some errors in the table where division has a value but team is blank. Given

Re: convert help

2006-01-21 Thread Gleb Paharenko
Hello. ERROR 1314 (0A000): PREPARE is not allowed in stored procedures PREPARE in the stored procedures should work in the latest release (5.0.18). David Godsey wrote: Thank you. I tried this outside of the procedure and it works. However In MYSQL 5 I get: ERROR 1314 (0A000): PREPARE is

Re: convert help

2006-01-20 Thread Gleb Paharenko
Hello. You can use this technique: drop procedure if exists test20; DELIMITER $$ create procedure test20() BEGIN DECLARE fdata BLOB; DECLARE foffset INT UNSIGNED; DECLARE flength INT UNSIGNED; DECLARE tmp_int BIGINT UNSIGNED; SELECT

Re: convert help

2006-01-20 Thread David Godsey
Thank you. I tried this outside of the procedure and it works. However In MYSQL 5 I get: ERROR 1314 (0A000): PREPARE is not allowed in stored procedures Is there a way without needing to use prepare? Any idea why CAST(fdata AS UNSIGNED) doesn't work? David Godsey Hello. You can use this

Re: Install help on Linux: I cant obtain access

2006-01-19 Thread Gleb Paharenko
Hello. See: http://dev.mysql.com/doc/refman/5.0/en/access-denied.html Wade Smart wrote: 01182006 1627 GMT-6 Im on Ubuntu. I have mysql 4.0.24. I have phpmyadmin installed. Im a little frustrated at this point so bear with me. Mysql is running. My book says type in: mysql -h localhost

Re: Need help counting player with lowest score for each week.

2006-01-09 Thread Thomas 'Skip' Hollowell
OK, turns out this was a two fold issue. The server I was on had 4.0 mySQL, which was severely limited in it's abilities to use subqueries. The server has since been update to the 4.1 series, and now the following 2-subquery query work just fine. SELECT firstname, lastname, B.playerid,

Re: RPM help

2006-01-06 Thread Jeffrey Goldberg
On Jan 6, 2006, at 4:38 PM, Jeffrey Goldberg wrote: I'm using SuSE 9.3 (not the Enterprise Server), and I would like to upgrade from MySQL 4.1 to the latest stable version. There do not appear to be SuSE rpms for 5.0. Someone has kindly pointed out to me off-list that there are generic

Re: SELECT help.

2006-01-06 Thread Richard Reina
Thank you very much to all who responded. I ended up using Shawn's solution, the others seem good as well. Thanks again. Have a great weekend. Richard [EMAIL PROTECTED] wrote: Try this: SELECT c_no , SUM(1) as total_tx , SUM(if(`date` = now() - interval 6 month,1,0))

Re: SELECT help.

2006-01-05 Thread Rhino
- Original Message - From: Richard Reina [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Thursday, January 05, 2006 10:29 AM Subject: SELECT help. Can someone help me write a query to tell me the customer numbers (C_NO) of those who've had more than 4 transactions but none in

Re: SELECT help.

2006-01-05 Thread Richard Reina
3.23.54 Thanks. Rhino [EMAIL PROTECTED] wrote: - Original Message - From: Richard Reina To: Sent: Thursday, January 05, 2006 10:29 AM Subject: SELECT help. Can someone help me write a query to tell me the customer numbers (C_NO) of those who've had more than 4 transactions

Re: SELECT help.

2006-01-05 Thread SGreen
Try this: SELECT c_no , SUM(1) as total_tx , SUM(if(`date` = now() - interval 6 month,1,0)) as recent_tx FROM transactions_table GROUP BY c_no HAVING total_tx 4 and recent_tx = 0; Shawn Green Database Administrator Unimin Corporation - Spruce Pine Rhino [EMAIL PROTECTED] wrote on

Re: SELECT help.

2006-01-05 Thread Michael Stassen
Richard Reina wrote: Can someone help me write a query to tell me the customer numbers (C_NO) of those who've had more than 4 transactions but none in the last 6 months? transactions_table | ID | C_NO |DATE | AMOUT | | 2901 | 387 | 2003-10-09 | 23.00 | Obviously my

Re: SELECT help.

2006-01-05 Thread James Harvard
This should work: select c_name, count(t1.id) as t_count from customers c inner join transactions t1 on c.c_no = t1.c_no left join transactions t2 on c.c_no = t2.c_no and t2.date '2005-06-05' where t2.id is null group by c.c_no having t_count 4; There may be more efficient way of doing this

Re: SELECT help.

2006-01-05 Thread Peter Brawley
Richard, Can someone help me write a query to tell me the customer numbers (C_NO) of those who've had more than 4 transactions but none in the last 6 months? Something like this? SELECT c_no, COUNT(c_no) AS cnt FROM transactions_table WHERE NOT EXISTS ( SELECT c_no FROM

Re: need help with user variables in where clause of sub query

2005-12-29 Thread Dan Rossi
Thanks for your kind words of opinion, if you feel you have a better way please do go ahead , i am going to show you the sql i ended up using which was a union to append the current summary at the end, i then had to use php afterwards to add up the totals as i was getting unexpected results

Re: need help with user variables in where clause of sub query

2005-12-29 Thread SGreen
Dan Rossi [EMAIL PROTECTED] wrote on 12/29/2005 07:19:13 AM: Thanks for your kind words of opinion, if you feel you have a better way please do go ahead , i am going to show you the sql i ended up using which was a union to append the current summary at the end, i then had to use php

Re: Need Help Writing a Trigger

2005-12-28 Thread Jesse
It's not as simple as that. First, if you subtract the curdate() from the birthday (or vice versa), you end up with some large number that isn't the actual age at all. So, the calculation is a bit more complicated than that. Also, I'm not interested in their current age, but their age at the

Re: Need Help Writing a Trigger

2005-12-28 Thread Peter Brawley
Jesse, Therefore, instead of putting that long calculation in my query every time, I'm looking for a simpler solution, a more automatic one. CREATE FUNCTION Age( dob DATE, today DATE ) RETURNS INTEGER DETERMINISTIC BEGIN RETURN DATE_FORMAT(FROM_DAYS(TO_DAYS(today) - TO_DAYS(dob)), '%Y') + 0;

Re: need help with user variables in where clause of sub query

2005-12-28 Thread SGreen
You seem to be coming at SQL with a COBOL perspective. Views are something you typically create just once and they stay updated automatically. They work like tables not like queries. Assigning variables to each column of a view doesn't make any sense (in the SQL sense of view) as each column

Re: Need Help Writing a Trigger

2005-12-28 Thread Jesse
, Jesse - Original Message - From: Peter Brawley [EMAIL PROTECTED] To: Jesse [EMAIL PROTECTED] Cc: MySQL List mysql@lists.mysql.com Sent: Wednesday, December 28, 2005 10:20 AM Subject: Re: Need Help Writing a Trigger Jesse, Therefore, instead of putting that long calculation in my query

Re: Need Help Writing a Trigger

2005-12-28 Thread Peter Brawley
] To: Jesse [EMAIL PROTECTED] Cc: MySQL List mysql@lists.mysql.com Sent: Wednesday, December 28, 2005 10:20 AM Subject: Re: Need Help Writing a Trigger Jesse, Therefore, instead of putting that long calculation in my query every time, I'm looking for a simpler solution, a more automatic one

Re: Urgent help using logon to mySQL

2005-12-28 Thread SGreen
Aftab Khan [EMAIL PROTECTED] wrote on 12/28/2005 02:15:33 PM: Can some one please tell me what I am doing wrong here I have installed and configured users in the database. I am using ODBC driver to logon. When I use the password, it does not work but surprisingly the logon is allowed

Re: Need Help Writing a Trigger

2005-12-28 Thread Jesse
] To: Jesse [EMAIL PROTECTED] Cc: MySQL List mysql@lists.mysql.com Sent: Wednesday, December 28, 2005 1:48 PM Subject: Re: Need Help Writing a Trigger Jesse, BTW, is there a way to change this function so that it does away with the today variable, and uses a field from a different database? For instance

Re: need help with user variables in where clause of sub query

2005-12-28 Thread Dan Rossi
Um, thast exactly right each select is a list of results , i want to merge them then manipulate the data after putting them into a view, maybe a temp table is needed for this but i dont really want to do an entire create table statement aswell :\ On 29/12/2005, at 2:48 AM, [EMAIL PROTECTED]

Re: need help with user variables in where clause of sub query

2005-12-28 Thread Dan Rossi
Btwi dont want the column of a view to be a variable, i think thats what it thinks ! Im just needing to send the value of the current primary key field top a sub query ! Read my latest post if i can get around not using variables, and still manage to get the right values of a current row

Re: need help with user variables in where clause of sub query

2005-12-28 Thread Dan Rossi
I just tried to create a Function or Stored Procedure instead of making variables but it didnt even let me do this CREATE FUNCTION test (customerID, month, producerID) RETURN SELECT SUM(fu.bandwidth) FROM feed_usage fu WHERE fu.customerID=customerID AND fu.month=month AND fu.feedID IN (SELECT

Re: need help with user variables in where clause of sub query

2005-12-28 Thread SGreen
Dan, You need to shoot your SQL tutor. Whoever taught you to write aggregate queries seriously took your money. You DO NOT need to use subqueries to do what you want to do. You do not need to write a full CREATE TABLE statement to create a temporary table (see other response). You do not need

Re: Need Help Writing a Trigger

2005-12-27 Thread John Meyer
On Tuesday 27 December 2005 2:34 pm, Jesse wrote: I'm trying to write a trigger that will update the age of a camper when ever a record is updated or inserted. I have a table named Campers which contains basic information about the camper as well as their birthday. I have another table named

Re: need help with user variables in where clause of sub query

2005-12-27 Thread SGreen
Dan Rossi [EMAIL PROTECTED] wrote on 12/27/2005 11:39:57 PM: Hi there i am trying to use usewr variables in a select statement to add to a where clause in a sub query. Ie select @id:=id,@month:=month, (select SUM(totals) from table where [EMAIL PROTECTED] and [EMAIL PROTECTED]) as totals

Re: need help with user variables in where clause of sub query

2005-12-27 Thread Dan Rossi
I have an unfinished query, i am trying to test, basically im required to get the value of the current field in a row and use it for a subquery in that row :| Its not a working query, and im not asking for someone to fix it, however as u can see i need to send the customerID and month to the

Re: Need Help Connecting

2005-12-22 Thread Michael Stassen
Mark Phillips wrote: David, This is what I got: [EMAIL PROTECTED]:~$ aliases bash: aliases: command not found Your shell is bash, so the correct command is `alias`. [EMAIL PROTECTED]:~$ which mysql /usr/bin/mysql Since you are using bash, it's a better idea to use `type` instead of

Re: Need Help Connecting

2005-12-22 Thread Mark Phillips
Here are the results of alias and type [EMAIL PROTECTED]:~$ alias alias ls='ls --color=auto' [EMAIL PROTECTED]:~$ type mysql mysql is /usr/bin/mysql And for the emily account: [EMAIL PROTECTED]:/home/mark$ alias alias ls='ls --color=auto' [EMAIL PROTECTED]:/home/mark$ type mysql mysql is

Re: need help

2005-12-22 Thread SGreen
You will experience the same problem with old-client vs. new-server authentication as you did when you first set up your user accounts for 4.1 but other than that , it should be compatible. http://dev.mysql.com/doc/refman/5.0/en/old-client.html Shawn Green Database Administrator Unimin

Re: need help

2005-12-22 Thread Gleb Paharenko
Hello. In my opinion, if it works in general with 5.0. MySQL tries to keep backward compatibility for its products as much as possible. So it should work, however, not all features of 5.0 could be available. MyODBC 3.51.12 is suitable for use with any MySQL version including MySQL 4.1 or

RE: Need Help Connecting

2005-12-21 Thread Logan, David (SST - Adelaide)
Hi Mark, Have you checked to see if you any aliases set? It might be using that instead of the mysql command. May well be worth checking your path to ensure you aren't picking up a script called mysql or something similar. Regards David Logan Database Administrator HP Managed Services 148

Re: Need Help Connecting

2005-12-21 Thread Mark Phillips
David, How do I do that? Thanks! Mark On Wednesday 21 December 2005 11:37 pm, Logan, David (SST - Adelaide) wrote: Hi Mark, Have you checked to see if you any aliases set? It might be using that instead of the mysql command. May well be worth checking your path to ensure you aren't

<    1   2   3   4   5   6   7   8   9   10   >