RE: sql help: delete row where only related to one other row

2008-02-21 Thread roger.maynard
tables, you should not define several ON UPDATE CASCADE clauses that act on the same column in the parent table or in the child table. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 20 February 2008 12:44 To: mysql@lists.mysql.com Subject: sql help: delete row

sql help: delete row where only related to one other row

2008-02-20 Thread douglass_davis
Say I have two tables: table_a -- a_id (primary key) b_id table_b -- b_id (primary key) name there is a one to many mapping between rows in table b and rows in table a. Say I had an Id of a row in table a an (a_id, say 5). Now, what I want to do is delete the row in table_a

SQL help/problem with timestamped data differences

2008-01-08 Thread mark carson
Hi All I have the following data example UID Timestamp 123456 20071201 12:00:01 123456 20071201 12:00:06 987654 20071201 12:00:01 987654 20071201 12:00:09 etc I need : UID Timestamp secs 123456 20071201 12:00:01

Re: SQL help/problem with timestamped data differences

2008-01-08 Thread Dan Buettner
Mark, is the 'secs' column the offset from the minimum value of the timestamp column? If so, you might try something like this: SELECT UNIX_TIMESTAMP(MIN(timestamp)) INTO @min_timestamp FROM my_table; SELECT uid, timestamp, UNIX_TIMESTAMP(timestamp) - @min_timestamp AS secs FROM my_table ORDER

Complex sql help

2007-04-02 Thread Bryan Cantwell
I have a need to output a recordset that shows the record with the higest value for severity within a date range. That is easy enough, but, in the same query, I need to show that data 3 times in the same query. Once where event_avail = 1, then again where event_perf = 1 and finally where even_sec

a lil sql help please.

2006-07-09 Thread m i l e s
Hi, I have the following Query and Im a lil lost on this one SELECT DISTINCT tbe_orders.order_id, tbe_orders.order_date, tbe_orders.order_piececount FROM tbe_orders The query produces the following results: +++ + order_id + order_date +

Re: a lil sql help please.

2006-07-09 Thread Davor Dundovic
At 18:51 9.7.2006, you wrote: Hi, I have the following Query and Im a lil lost on this one SELECT DISTINCT tbe_orders.order_id, tbe_orders.order_date, tbe_orders.order_piececount FROM tbe_orders SELECT tbe_orders.order_id, tbe_orders.order_date, sum(tbe_orders.order_piececount) FROM

Re: a lil sql help please.

2006-07-09 Thread John L Meyer
m i l e s wrote: Hi, I have the following Query and Im a lil lost on this one SELECT DISTINCT tbe_orders.order_id, tbe_orders.order_date, tbe_orders.order_piececount FROM tbe_orders The query produces the following results: +++ + order_id +

A bit of SQL help for a MySQL novice.

2005-11-17 Thread Rick Dwyer
Hello All. I am hoping for a bit of help with some code that has really given me some trouble. If this is not he correct forum for this any help in pointing me to a more suited list would be appreciated. I have a MySQL 4.1.x database containing records with phone numbers. Most of the

Re: A bit of SQL help for a MySQL novice.

2005-11-17 Thread SGreen
Rick Dwyer [EMAIL PROTECTED] wrote on 11/17/2005 10:28:51 AM: Hello All. I am hoping for a bit of help with some code that has really given me some trouble. If this is not he correct forum for this any help in pointing me to a more suited list would be appreciated. I have a MySQL

Re: A bit of SQL help for a MySQL novice.

2005-11-17 Thread Rhino
- Original Message - From: Rick Dwyer [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Thursday, November 17, 2005 10:28 AM Subject: A bit of SQL help for a MySQL novice. Hello All. I am hoping for a bit of help with some code that has really given me some trouble

Re: A bit of SQL help for a MySQL novice.

2005-11-17 Thread Rick Dwyer
10:28 AM Subject: A bit of SQL help for a MySQL novice. Hello All. I am hoping for a bit of help with some code that has really given me some trouble. If this is not he correct forum for this any help in pointing me to a more suited list would be appreciated. I have a MySQL 4.1.x

Re: A bit of SQL help for a MySQL novice.

2005-11-17 Thread Rhino
- Original Message - From: Rick Dwyer [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Thursday, November 17, 2005 11:53 AM Subject: Re: A bit of SQL help for a MySQL novice. Unfortunately, the phone numbers come from text logs that get imported into mysql. Because the phone number is often

Re: A bit of SQL help for a MySQL novice.

2005-11-17 Thread Peter Brawley
Rick I need to read the first 4 positions in the phone number to determine it's location. My statement looks like this: 'Select mid(phone, 1,4) as phoneareacode from phonetable' This works but if the number is entered as 1(203)-555-1212 the above would return 1(20 which is not what I am

RE: A bit of SQL help for a MySQL novice.

2005-11-17 Thread Mikhail Berman
SELECT LENGTH('text'); - 4 Mikhail Berman -Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED] Sent: Thursday, November 17, 2005 1:51 PM To: Rick Dwyer Cc: mysql@lists.mysql.com Subject: Re: A bit of SQL help for a MySQL novice. Rick I need to read the first 4

Re: SQL help for qty Sold YTD...

2005-11-04 Thread Rhino
making it go faster. Rhino - Original Message - From: [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, November 04, 2005 12:28 AM Subject: SQL help for qty Sold YTD... I cannot figure this one out. I have a Category table with 50,000 records, an Inventory table with over 2 million

Re: SQL help for qty Sold YTD...

2005-11-04 Thread SGreen
I would first try refactoring your SQL to use INNER JOIN statements instead of the comma separated lists you are currently using. I would also not use any subqueries. Test this and see if it works for you: SELECT SUM(li.quantity) as qtysoldytd FROM LineItem li INNER JOIN Sales sa on

SQL help for qty Sold YTD...

2005-11-03 Thread wodev
I cannot figure this one out. I have a Category table with 50,000 records, an Inventory table with over 2 million records. A Sales table with 500,000 records. And a LineItem table with 800,000 records pairing the Inventory ID with the Sales Transaction ID and Quantity. I need to generate a

SQL help: Updating Strange Chrs.

2005-09-22 Thread m i l e s
Hi, I have an odd situation where I was handed just bad data, and while I have cleaned it up to the best of my ability one hurdle remains. I have a situation where I have the following example in a field: Canna ÒBengalÒ. Note the odd chrs Ò in the field ? I need to get rid of those, my

Re: SQL help: Updating Strange Chrs.

2005-09-22 Thread Daniel Kasak
m i l e s wrote: Hi, I have an odd situation where I was handed just bad data, and while I have cleaned it up to the best of my ability one hurdle remains. I have a situation where I have the following example in a field: Canna ÒBengalÒ. Note the odd chrs Ò in the field ? I need to

SQL help

2005-08-23 Thread Darryl Hoar
Greetings, I have a table in my database called item. It has two fields: item and description. Unfortunately the item field has got data with quotes around it. IE KP-00310. I need to clean up the data and have the field contain just KP-00310. Since I have 10,000 records, I need a update

RE: SQL help

2005-08-23 Thread Jay Blanchard
[snip] Unfortunately the item field has got data with quotes around it. IE KP-00310. I need to clean up the data and have the field contain just KP-00310. Since I have 10,000 records, I need a update statement or something to clean that up. Any ideas ? [/snip]

Re: SQL help

2005-08-23 Thread Peter Brawley
Darryl, Unfortunately the item field has got data with quotes around it. IE "KP-00310". I need to clean up the data and have the field contain just KP-00310. Since I have 10,000 records, I need a update statement or something to clean that up. To remove all double quotes: UPDATE tablename

Re: SQL help

2005-06-26 Thread Jochem van Dieten
On 6/26/05, 2wsxdr5 wrote: Can someone tell me why this query works... SELECT UserKey FROM( SELECT UserKey, Count(GiftKey) Gifts FROM Gift Group BY UserKey ) GC WHERE GC.Gifts = 3 Why this construction and not simply: SELECT UserKey FROM Gift GROUP BY UserKey HAVING Count(GiftKey) =

SQL help

2005-06-25 Thread 2wsxdr5
Can someone tell me why this query works... SELECT UserKey FROM( SELECT UserKey, Count(GiftKey) Gifts FROM Gift Group BY UserKey ) GC WHERE GC.Gifts = 3 And this one doesn't? SELECT UserKey, UserID, FROM User WHERE UserKey IN (SELECT UserKey FROM( SELECT UserKey, Count(GiftKey) Gifts

SQL help

2005-02-28 Thread Rob Brooks
Can someone help me with this? this statement: select Items.Name, Items.Detail, Items.ID, items_online.ID from Items left join items_online on items_online.ItemKey = Items.ID where (Name regexp 'ad') and AccountKey = 108 and Items.Active = 1; gives this:

RE: SQL help

2005-02-28 Thread Rob Brooks
Subject: SQL help Can someone help me with this? this statement: select Items.Name, Items.Detail, Items.ID, items_online.ID from Items left join items_online on items_online.ItemKey = Items.ID where (Name regexp 'ad') and AccountKey = 108 and Items.Active = 1; gives

RE: SQL help

2005-02-28 Thread Michael Dykman
'7047' but in the record which starts with the name 'Triad' also ... I'm using 4.0.20-standard-log -Original Message- From: Rob Brooks [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 2:56 PM To: mysql@lists.mysql.com Subject: SQL help Can someone help me

Re: SQL help

2005-02-28 Thread Michael Stassen
' but in the record which starts with the name 'Triad' also ... I'm using 4.0.20-standard-log -Original Message- From: Rob Brooks [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 2:56 PM To: mysql@lists.mysql.com Subject: SQL help Can someone help me with this? this statement

Re: SQL help

2005-02-28 Thread Harald Fuchs
In article [EMAIL PROTECTED], Rob Brooks [EMAIL PROTECTED] writes: The only difference in the 2 statements is the 'where items_online.ID = NULL' part. Clearly in the first set, items_online.ID = NULL in record 7047 ... Nope. items_online.ID IS NULL for that record, but comparing anything =

subquery SQL help

2004-07-17 Thread leegold
I tried what's below, seemed OK, so I replaced an IN for the = in the subquery below because of the subquery's error message. I thought w/IN I'd get three (3) records returned as expected. But when I tried IN I got my entire DB returned - I don't show that below - it kept scrolling so I aborted

Re: subquery SQL help

2004-07-17 Thread leegold
I could not get the subquery to work, but the sql below did what I wanted:^) SELECT balloon_rec.* FROM `balloon_rec` LEFT JOIN `balloon_txt` USING (`access_no`) WHERE MATCH (`balloon_txt`.`access_no`,`balloon_txt`.`recs_txt`) AGAINST ('meteorology') On Sat, 17 Jul 2004 12:15:20 -0400, leegold

SQL help

2004-06-03 Thread Bob Lockie
What I really want was mysql update records set records.prio=2 where records.in=(select records.id from records, audit_log, audit_log_records where audit_log.tracker_id=audit_log_records.tracker_id and records.id=audit_log_records.id and audit_log.operation='D' and audit_log.completed is

Re: SQL help

2004-06-03 Thread Michael Stassen
Bob Lockie wrote: What I really want was mysql update records set records.prio=2 where records.in=(select records.id from records, audit_log, audit_log_records where audit_log.tracker_id=audit_log_records.tracker_id and records.id=audit_log_records.id and audit_log.operation='D' and

Re: SQL help

2004-06-03 Thread Egor Egorov
Bob Lockie [EMAIL PROTECTED] wrote: What I really want was mysql update records set records.prio=2 where records.in=(select records.id from records, audit_log, audit_log_records where audit_log.tracker_id=audit_log_records.tracker_id and records.id=audit_log_records.id and

MySql SQL Help

2004-04-01 Thread Ramesh
Hi, Need a SQL/Design help. I have a table as follows: ORDER_HISTORY -- ORDER_ID | ORDER_NAME | ORDER_AMOUNT | ORDER_DATE -- 10 | Order 1| 20.00| 10-Jan-2003 11 | Order 2| 200.00 |

Re: MySql SQL Help

2004-04-01 Thread Rhino
by the week() function and make sure you pick the one that matches the rules in your environment. Rhino - Original Message - From: Ramesh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 01, 2004 11:12 PM Subject: MySql SQL Help Hi, Need a SQL/Design help. I have a table

SQL-help needed

2004-02-19 Thread Carl Schéle, IT, Posten
Hi! I got a table, champions, looking like this: idclass winner_1 winner_2 year - 0 hd carl mattias 1957 1 hs daniel

RE: SQL-help needed

2004-02-19 Thread Ligaya Turmelle
:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 6:50 PM To: [EMAIL PROTECTED] Subject: SQL-help needed Hi! I got a table, champions, looking like this: idclass winner_1 winner_2 year

Re: SQL-help needed

2004-02-19 Thread Michael Stassen
Carl Schéle, IT, Posten wrote: Hi! I got a table, champions, looking like this: idclass winner_1 winner_2 year - 0 hd carl mattias 1957 1

SQL-HELP

2004-02-18 Thread Carl Schéle, IT, Posten
Hi! I got a table, champions, looking like this: id class winner_1 winner_2 year - 0 hd carl mattias 1957 1 hs

SQL-HELP

2004-02-17 Thread Carl Schéle, IT, Posten
Hello! I got a table, champions, looking like this: id winner_1 winner_2 0carl mattias 1daniel carl 2erik

Re: SQL-HELP

2004-02-17 Thread Jonas Lindén
Hello, you might want to try select DISTINCT ? http://www.mysqlfreaks.com/statements/18.php /Jonas - Original Message - From: Carl Schéle, IT, Posten [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 17, 2004 3:49 PM Subject: SQL-HELP Hello! I got a table, champions

SV: SQL-HELP

2004-02-17 Thread Rodolphe Toots
februari 2004 16:01 Till: Carl Schéle; IT; Posten; [EMAIL PROTECTED] Ämne: Re: SQL-HELP Hello, you might want to try select DISTINCT ? http://www.mysqlfreaks.com/statements/18.php /Jonas - Original Message - From: Carl Schéle, IT, Posten [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent

SV: SQL-HELP

2004-02-17 Thread Carl Schéle, IT, Posten
Now UNION is implemented in MySQL 4.0.0. and as I stated earlier I run 3.23.58. -Ursprungligt meddelande- Från: Rodolphe Toots [mailto:[EMAIL PROTECTED] Skickat: den 17 februari 2004 16:19 Till: Jonas Lindén; Carl Schéle; [EMAIL PROTECTED] Ämne: SV: SQL-HELP yeah but that wont really do

Re: SQL-HELP

2004-02-17 Thread Jochem van Dieten
Carl Schéle, IT, Posten wrote: I got a table, champions, looking like this: id winner_1 winner_2 0carl mattias 1daniel carl 2

SV: SQL-HELP

2004-02-17 Thread Carl Schéle, IT, Posten
. But it's cheap :) /Carl -Ursprungligt meddelande- Från: Jochem van Dieten [mailto:[EMAIL PROTECTED] Skickat: den 17 februari 2004 16:44 Till: Carl Schéle, IT, Posten Kopia: [EMAIL PROTECTED] Ämne: Re: SQL-HELP Carl Schéle, IT, Posten wrote: I got a table, champions, looking like

SQL Help

2004-01-16 Thread sulewski
Hello, Hopefully you sql guru's can help me out a bit. :) Here is the short example of what I want to accomplish. I wish to have the difference between two different select queries. So if one query pulls records 1,2,3 and 4 and the second pulls records 1 and 4 I wish to have only the records 2

Re: SQL Help

2004-01-16 Thread Roger Baklund
* sulewski [...] What I need is all records in table 1 that will not link to table 2 such that relid=rid and vid=46 Sounds like a job for LEFT JOIN...? Join to the rows you do NOT want with a left join, and put as a condition in the WHERE clause that a joined column IS NULL. Something like

Re: SQL Help

2004-01-16 Thread sulewski
Roger, Thank you for the feedback. But unfortunately this doesn't work. The problem is that rid will never be null. I'm trying to find the item in tab1 where a link cannot be created in tab2 where tab2.rid=tab1.id and tab2.vid=46 because there is no record in tab2. Not that the record may

Re: SQL Help

2004-01-16 Thread sulewski
Roger, In regards to my last e-mail what would be great is if I can get all the records in tab1 then subtract from there all the records that match the query tab1.id=tab2.rid and tab2.vid=46. The result would give me what I need but alas mysql doesn't support minus. Joe On Friday, January

Re: SQL Help

2004-01-16 Thread gerald_clark
That is the whole point of a left join. It joins to a null record when the appropriate right record does not exist. sulewski wrote: Roger, Thank you for the feedback. But unfortunately this doesn't work. The problem is that rid will never be null. I'm trying to find the item in tab1 where a

Re: SQL Help

2004-01-16 Thread sulewski
Gerald, Your right. You and Roger hit it on the head. Stupid me miss read Roger's original post. Last night I was banging my head on the left and right joins but I didn't understand it until I read Gerald's last note. Plus I didn't realize you can put two conditions in the ON clause which is

SQL Help please

2003-09-11 Thread Dave Shelley
SQL guru's, I could use some help writing a bit of SQL. There's 3 tables: orderable_parts partID varchar, topCatID int, # top level category ID ... part_attributes partID varchar, attName varchar, attValue varchar, ... topcatattributevalues tcavID int, topCatID int, attName varchar, attValue

Re: SQL Help...

2003-07-25 Thread Info
Estoy tomando el sol . q -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: SQL Help...

2003-07-25 Thread Info
Estoy tomando el sol . q -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

SQL Help...

2003-07-24 Thread nick
After some searching around different books/manuals/google I still can't seem to figure out how do to this. What I have is a table with 4 cols (task, resource, department, priority) and what I want to do is be able to select distinct resources and list what their highest priority is. In other

RE: SQL Help...

2003-07-24 Thread Dathan Vance Pattishall
---Original Message- --From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] --Sent: Thursday, July 24, 2003 12:53 PM --To: [EMAIL PROTECTED] --Subject: SQL Help... -- --After some searching around different books/manuals/google I still can't --seem to figure out how do to this. What I have

Re: SQL Help...

2003-07-24 Thread mos
At 02:52 PM 7/24/2003, you wrote: After some searching around different books/manuals/google I still can't seem to figure out how do to this. What I have is a table with 4 cols (task, resource, department, priority) and what I want to do is be able to select distinct resources and list what their

RE: SQL Help...

2003-07-24 Thread nick
. ---Original Message- --From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] --Sent: Thursday, July 24, 2003 12:53 PM --To: [EMAIL PROTECTED] --Subject: SQL Help... -- --After some searching around different books/manuals/google I still can't --seem to figure out how do to this. What I have

RE: SQL Help...

2003-07-24 Thread Cabanillas Dulanto, Ulises
Try: select task, resource, department, max(priority) from table group by task, resource, department Regards, Ulises -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Enviado el: Jueves 24 de Julio de 2003 02:53 PM Para: [EMAIL PROTECTED] Asunto: SQL Help... After

Re: SQL Help...

2003-07-24 Thread nick
That works great. =D Knew it shouldn't be that difficult, thanks a bunch. And it actually works with the Priorities being in text form to (low, med, hi). -Nick At 02:52 PM 7/24/2003, you wrote: After some searching around different books/manuals/google I still can't seem to figure out how do to

RE: SQL Help...

2003-07-24 Thread Lin Yu
To: Dathan Vance Pattishall Cc: [EMAIL PROTECTED] Subject: RE: SQL Help... I looked at the group by option already and I dont think it will do what I need it to do. I say this because it will only group things in the priority/task/whatever but that still leaves options for duplicate resources. Yes

RE: SQL Help...

2003-07-24 Thread nick
PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 4:41 PM To: Dathan Vance Pattishall Cc: [EMAIL PROTECTED] Subject: RE: SQL Help... I looked at the group by option already and I dont think it will do what I need it to do. I say this because it will only group things

sql help

2002-12-23 Thread Adam Nowalsky
hi, wonder if the sql gurus can help with this one. i have two tables (simplified), tblAccounts and tblAccountsServices. tblAccounts has an ID (PK) and an accountNumber, and tblAccountsServices has an ID (PK) and accountID (FK to tblAccounts.ID). i want to run a query that gives me a row for

Re: sql help

2002-12-23 Thread William R. Mussatto
You want to look at 'group by acctSrv.accountID' rather than a compound select. On Mon, 23 Dec 2002, Adam Nowalsky wrote: Date: Mon, 23 Dec 2002 09:04:32 -0500 From: Adam Nowalsky [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: sql help hi, wonder if the sql gurus can help

sql help

2002-12-19 Thread Adam Nowalsky
hi, wonder if the sql gurus can help with this one. i have two tables (simplified), tblAccounts and tblAccountsServices. tblAccounts has an ID (PK) and an accountNumber, and tblAccountsServices has an ID (PK) and accountID (FK to tblAccounts.ID). i want to run a query that gives me a row for

sql help

2002-12-19 Thread Adam Nowalsky
btw, regarding my last post, i'm running mysql 3.23.53-max-nt... - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread,

Re: AW: SQL help, search with related record in 2nd table

2002-09-11 Thread Michael Collins
. September 2002 22:40 An: [EMAIL PROTECTED] Betreff: SQL help, search with related record in 2nd table I am looking for some help on a SQL query to perform a search, but constrain the search to those records which have a related record in a second table. What I think I need is a subselect, but since

SQL help, search with related record in 2nd table

2002-09-10 Thread Michael Collins
I am looking for some help on a SQL query to perform a search, but constrain the search to those records which have a related record in a second table. What I think I need is a subselect, but since this is not possible in 3.23.47, I am looking for work around. I have one table for Visitors

SQL Help Needed

2002-05-23 Thread Dave
I have 2 tables Users (UserID) History (UserID, WeekID, Points) When a User record is created a record is inserted into History with the current WeekID, so for example data could be : Users History -- - 1 - 10 - 1 - 20 - 1 - 30 - 2 -

Re: SQL Help Needed

2002-05-23 Thread Nick Stuart
Ok this should be easy so I'm prolly going to screw it up, but here goes =D Your query should be: SELECT UserID, SUM(points) FROM History WHERE WeekID = 'whatever' GROUP BY UserIdI think that should do it. Someone yell if its wrong though. -Nick I have 2 tables Users (UserID) History

RE: SQL Help Needed

2002-05-23 Thread Roger Baklund
* Dave I have 2 tables Users (UserID) History (UserID, WeekID, Points) When a User record is created a record is inserted into History with the current WeekID, so for example data could be : Users History -- - 1 - 10 - 1 - 20

Re: SQL Help Needed

2002-05-23 Thread Dave
exist for WeekID = 2, other for 1 and 2 and so on. Cheers Dave - Original Message - From: Roger Baklund [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Dave [EMAIL PROTECTED] Sent: Thursday, May 23, 2002 6:21 PM Subject: RE: SQL Help Needed * Dave I have 2 tables Users (UserID

RE: SQL Help Needed

2002-05-23 Thread Roger Baklund
* Dave Thanks for your responses but it's not that much help I need with my SQL ;-) None of the 3 suggestions work. Please look at the examples I gave. I need *all* UserIDs regardless of whether they have a record in History that matches both UserID and WeekID. ...and that is what I

SQL HELP!

2002-04-07 Thread Roberto Ramírez
What the hell this query do!? SELECT student.name FROM student WHERE not exists( SELECT * FROM enrollment WHERE not exists( SELECT * FROM class

sql help examining log table

2002-03-17 Thread Viraj Alankar
Hello, We use mysql to store outgoing email headers from our users and do throttling on users that appear to be spamming based on some simple queries to this table. We use the Communigate mail server and this throttling script is a PERL program implemented as a content filter. More information

RE: sql help examining log table

2002-03-17 Thread Dan Vande More
To: [EMAIL PROTECTED] Subject: sql help examining log table Hello, We use mysql to store outgoing email headers from our users and do throttling on users that appear to be spamming based on some simple queries to this table. We use the Communigate mail server and this throttling script is a PERL

RE: sql help examining log table

2002-03-17 Thread Dan Vande More
of coffee:) -Original Message- From: Dan Vande More [mailto:[EMAIL PROTECTED]] Sent: Sunday, March 17, 2002 1:44 PM To: [EMAIL PROTECTED] Subject: RE: sql help examining log table I might be wrong, but this may get you going in the right direction: select count(subject) as count, subject from

Re: sql help examining log table

2002-03-17 Thread Anvar Hussain K.M.
Hi Viraj, You can do it using temporary table. Create temporary table tmp select subject from outgoing where auth='USER' order by timestamp desc limit 50; Select count(distinct subject) from tmp group by subject; drop table tmp; If the result of the second query is 1 all the last 50 messages

SQL Help, Please...

2002-02-14 Thread Carl Shelbourne
Hi I am trying to write an auction script that uses mysql as its backend. Each auction can have upto 25 sub auctions(cells) taking place. I'm trying to query the DB to give me a list of all the successfull bids for each cell, for each auction... SELECT b.auctionId, b.cellId, MAX(b.bid) as bid,

Re: SQL Help, Please...

2002-02-14 Thread Tod Harter
On Thursday 14 February 2002 07:58, Carl Shelbourne wrote: Hi I am trying to write an auction script that uses mysql as its backend. Each auction can have upto 25 sub auctions(cells) taking place. I'm trying to query the DB to give me a list of all the successfull bids for each cell, for

Re: SQL Help, Please...

2002-02-14 Thread Anvar Hussain K.M.
Hi, At 11:21 AM 14/02/2002 -0500, you wrote: On Thursday 14 February 2002 07:58, Carl Shelbourne wrote: Hi I am trying to write an auction script that uses mysql as its backend. Each auction can have upto 25 sub auctions(cells) taking place. I'm trying to query the DB to give me a

SQL help plz

2002-01-30 Thread P.Agenbag
Hi I need help with an sql string: have a table similar to this: idkeynamedate 1 123name1 date1 2 123name1 date2 3 111name2 date1 4 111name2 date2 5 123name1 date3

Re: SQL help plz

2002-01-30 Thread Paul DuBois
At 21:36 +0200 1/30/02, P.Agenbag wrote: Hi I need help with an sql string: have a table similar to this: idkeynamedate 1 123name1 date1 2 123name1 date2 3 111name2 date1 4 111name2 date2

RE: SQL help plz

2002-01-30 Thread Rick Emery
: Wednesday, January 30, 2002 1:36 PM To: mysql Subject: SQL help plz Hi I need help with an sql string: have a table similar to this: idkeynamedate 1 123name1 date1 2 123name1 date2 3 111name2 date1 4 111

RE: SQL help plz

2002-01-30 Thread Rick Emery
Sorry, I meant: mysql select name,max(dateq) from mytable group by keyq; -Original Message- From: Rick Emery Sent: Wednesday, January 30, 2002 2:14 PM To: 'P.Agenbag'; mysql Subject: RE: SQL help plz mysql describe mytable; +---+--+--+-+-+---+ | Field

RE: SQL help plz

2002-01-30 Thread Rick Emery
Further, I'd advise NOT using field names like date and key. Using eserved words is never a good prcatice. -Original Message- From: Rick Emery Sent: Wednesday, January 30, 2002 2:16 PM To: 'P.Agenbag'; 'mysql' Subject: RE: SQL help plz Sorry, I meant: mysql select name,max(dateq

Re: SQL help plz

2002-01-30 Thread Steve Severance
Try this: select key_col, min(name), max(date_col) from my_table group by key_col ; You could use max(name) instead of min(name) also, although since the names can be misspelled, I don't see why it would matter which name is displayed. s.s. On Wed, 30 Jan 2002

SQL help

2001-05-08 Thread Webmaster
How do I write SQL in MySQL to randomly select 5 records from a table? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this

Re: SQL help

2001-05-08 Thread Zak Greant
SELECT * FROM db ORDER BY rand() LIMIT 5 --zak - Original Message - From: Webmaster [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 08, 2001 9:38 PM Subject: SQL help How do I write SQL in MySQL to randomly select 5 records from a table

Re: SQL help

2001-05-08 Thread Tony Shiu
want. 3) submit the query, select * from it where id in (your random record ids); - Original Message - From: Webmaster [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 11:38 AM Subject: SQL help How do I write SQL in MySQL to randomly select 5 records from a table

Re: SQL help

2001-05-08 Thread Webmaster
the above resultset, program to draw whatever number of records you want. 3) submit the query, select * from it where id in (your random record ids); - Original Message - From: Webmaster [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 11:38 AM Subject: SQL

Re: SQL help

2001-05-08 Thread Tony Shiu
using primary key of your table. mine works in both old and new versions. - Original Message - From: Webmaster [EMAIL PROTECTED] To: Tony Shiu [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 12:27 PM Subject: Re: SQL help i dont follow step #3. At 11:42 PM 5/8

Re: SQL help

2001-05-08 Thread j.urban
. 3) submit the query, select * from it where id in (your random record ids); - Original Message - From: Webmaster [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 09, 2001 11:38 AM Subject: SQL help How do I write SQL in MySQL to randomly select 5

Re: Fw: SQL HELP

2001-01-16 Thread j.urban
select *,DATE_FORMAT(datecolumn,'%M %D %Y'); On Tue, 16 Jan 2001, Mike Podlesny wrote: Thanks for your help but that unfortunately doesn't answer the question, unless I am looking at it wrong. I want the sql statement to read something to the affect: SELECT * FROM Table * is

Re: SQL HELP

2001-01-16 Thread Cindy
"j.urban" writes: select field1,field2,DATE_FORMAT(datefield,"%M %d, %Y"),field4,fieldn from table; He didn't want to have to explicitly list all 40 other fields, though. Can't he do something like SELECT *.DATE_FORMAT(datefield, "%M %d, %Y") FROM table; ? That gives him one extra field,