Re: Need Help Writing Simple Query

2010-07-26 Thread Mark Phillips
; - test1 table: col1v_idh_id America 1 2 - test2 table: id name 2 SAM 1 UNCLE - Original Message - From: Mark Phillips m...@phillipsmarketing.biz To: Mysql List mysql@lists.mysql.com Sent: Monday, July 26, 2010 8:29:00 AM Subject: Need Help Writing

Need Help Writing Simple Query

2010-07-25 Thread Mark Phillips
I have been away from sql for awhile, and can't seem to figure out how to write a simple query for two tables. Table 1 has many columns, two of which are hID and vID. Table 2 has two columns, ID and name. The hID and vID in table 1 correspond to the IDs in table 2. I want to make a query so I get

Re: Need Help Writing Simple Query

2010-07-25 Thread Nguyen Manh Cuong
SAM 1 UNCLE - Original Message - From: Mark Phillips m...@phillipsmarketing.biz To: Mysql List mysql@lists.mysql.com Sent: Monday, July 26, 2010 8:29:00 AM Subject: Need Help Writing Simple Query I have been away from sql for awhile, and can't seem to figure out how to write

Re: Need Help Writing Simple Query

2010-07-25 Thread John List
On 07/25/2010 09:29 PM, Mark Phillips wrote: I have been away from sql for awhile, and can't seem to figure out how to write a simple query for two tables. Table 1 has many columns, two of which are hID and vID. Table 2 has two columns, ID and name. The hID and vID in table 1 correspond to the

need help with delete query

2007-06-14 Thread Ben Liu
I'm trying to delete a subset of items in a table. The problem is, I don't want to query for the subset first, store the results and then run a series of delete queries. I believe this is a rather basic issue that has a well-accepted, simple solution which I am ignorant of. There are two relevant

Re: need help with delete query

2007-06-14 Thread Ben Liu
Thanks Brent, good tip. Works like a charm. On Jun 14, 2007, at 7:42 PM, Brent Baisley wrote: Here's a little trick. Get your DELETE query working as a SELECT. Then replace everything before FROM with DELETE tablename. SELECT order_items.ord_id FROM order_items LEFT JOIN orders ON

Re: need help with delete query

2007-06-14 Thread Reinhardt Christiansen
- Original Message - From: Ben Liu [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Thursday, June 14, 2007 3:11 PM Subject: need help with delete query I'm trying to delete a subset of items in a table. The problem is, I don't want to query for the subset first, store the results

Need help with a query

2006-01-23 Thread Mark Phillips
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 record with a blank

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: Need Help with a query

2005-12-12 Thread Gleb Paharenko
Hello. You may use these queries: select flight_id ,baseline*tan(radians(angle)) as attitude from flights where (baseline*tan(radians(angle))) = ( select max(baseline*tan(radians(angle))) from flights f2);

Need Help with a query

2005-12-11 Thread Mark Phillips
I have a table with several columns. The ones of interest are flight_id, angle, and baseline. I want to find the flight_ids for the flights with the maximum and minimum altitudes, where altitude=baseline*tan(radians(angle)). For example, Flights +++---+

Fw: Need Help with a query

2005-12-11 Thread Rhino
Oops, I meant to copy the list on this reply so that others could benefit Rhino - Original Message - From: Rhino [EMAIL PROTECTED] To: Mark Phillips [EMAIL PROTECTED] Sent: Sunday, December 11, 2005 6:19 PM Subject: Re: Need Help with a query - Original Message

Fwd: Re: Need Help with a query

2005-12-11 Thread Mark Phillips
I forgot to copy the list as well Mark -- Forwarded Message -- Subject: Re: Need Help with a query Date: Sunday 11 December 2005 06:47 pm From: Mark Phillips [EMAIL PROTECTED] To: Rhino [EMAIL PROTECTED] Rhino, My apologies for leaving out the version of mysql. I agree

Need help with a query..

2005-06-16 Thread Cory Robin
I need to speed up a search, big time. I have an application that searches for records on a date field. If it doesn't find an exact date match, it keeps searching adjacent days until it finds a certain amount of records. The problem now is, I'm using my application to loop through and run

Re: Need help with a query..

2005-06-16 Thread Alec . Cawley
Cory Robin [EMAIL PROTECTED] wrote on 16/06/2005 08:09:22: I need to speed up a search, big time. I have an application that searches for records on a date field. If it doesn't find an exact date match, it keeps searching adjacent days until it finds a certain amount of records. The

Re: Need help with a query..

2005-06-16 Thread SGreen
[EMAIL PROTECTED] wrote on 06/16/2005 11:30:10 AM: Cory Robin [EMAIL PROTECTED] wrote on 16/06/2005 08:09:22: I need to speed up a search, big time. I have an application that searches for records on a date field. If it doesn't find an exact date match, it keeps searching adjacent

Re: Need help with a query..

2005-06-16 Thread Alec . Cawley
[EMAIL PROTECTED] wrote on 16/06/2005 16:29:46: [EMAIL PROTECTED] wrote on 06/16/2005 11:30:10 AM: Cory Robin [EMAIL PROTECTED] wrote on 16/06/2005 08:09:22: I need to speed up a search, big time. I have an application that searches for records on a date field. If it

Fw: Need help with a query..

2005-06-16 Thread SGreen
(forwarded to the list - I am not the OP) - Forwarded by Shawn Green/Unimin on 06/16/2005 11:45 AM - James Black [EMAIL PROTECTED] wrote on 06/16/2005 11:44:36 AM: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote on 06/16/2005 11:30:10

Re: Need help with a query..

2005-06-16 Thread Frank Bax
At 03:09 AM 6/16/05, Cory Robin wrote: I need to speed up a search, big time. I have an application that searches for records on a date field. If it doesn't find an exact date match, it keeps searching adjacent days until it finds a certain amount of records. The problem now is, I'm using my

Re: MySQL (SQL) Newbie.. Need help with a Query

2005-06-07 Thread mfatene
hi, that's the same. If you use between, mysql do the rest for you : mysql explain SELECT * FROM passengers WHERE - reservation_date_time = '2005-01-01 12:10:00' - AND reservation_date_time = '2005-05-01 12:10:00';

Re: MySQL (SQL) Newbie.. Need help with a Query

2005-06-06 Thread mfatene
resubmitted Selon [EMAIL PROTECTED]: hi, that's the same. If you use between, mysql do the rest for you : mysql explain SELECT * FROM passengers WHERE - reservation_date_time = '2005-01-01 12:10:00' - AND reservation_date_time = '2005-05-01 12:10:00';

MySQL (SQL) Newbie.. Need help with a Query

2005-06-05 Thread Cory Robin
I'm trying to return all records between two dates.. The fields are datetime fields... Which is better? The following or using BETWEEN? (A little lost here) SELECT * FROM passengers WHERE reservation_date_time = '2005-01-01 12:10:00' AND reservation_date_time = '2005-05-01 12:10:00'; --

Re: MySQL (SQL) Newbie.. Need help with a Query

2005-06-05 Thread Sebastian
Cory Robin wrote: I'm trying to return all records between two dates.. The fields are datetime fields... Which is better? The following or using BETWEEN? (A little lost here) SELECT * FROM passengers WHERE reservation_date_time = '2005-01-01 12:10:00' AND reservation_date_time = '2005-05-01

Re: MySQL (SQL) Newbie.. Need help with a Query

2005-06-05 Thread Michael Stassen
Sebastian wrote: Cory Robin wrote: I'm trying to return all records between two dates.. The fields are datetime fields... Which is better? The following or using BETWEEN? (A little lost here) SELECT * FROM passengers WHERE reservation_date_time = '2005-01-01 12:10:00' AND

Re: Need help in basic query

2005-06-03 Thread Anoop kumar V
:1284FD4:103FB047DF1:-7ECF | 2005-05-20 14:39:29 | ++-+ 1 row in set (0.02 sec) Mathias Selon Anoop kumar V [EMAIL PROTECTED]: Hi mysql-ers, I need help in a basic query: I have this table: select * from

Need help in basic query

2005-06-02 Thread Anoop kumar V
Hi mysql-ers, I need help in a basic query: I have this table: select * from isr2_aud_log where id_secr_rqst IN ('TASK23C6054B9D416C08:1284FD4:103FB047DF1:-7ECF') --and name_rec_type = 'Assignment' order by id_secr_rqst, dt_aud_rec

Re: Need help in basic query

2005-06-02 Thread Anoop kumar V
just need the id_secr_rqst if and only if it has the latest name_rec_type as 'Assignment' - I do not care what the earlier records contained. help please, Anoop On 6/2/05, Anoop kumar V [EMAIL PROTECTED] wrote: Hi mysql-ers, I need help in a basic query: I have this table: select

Re: Need help in basic query

2005-06-02 Thread Anoop kumar V
the id_secr_rqst if and only if it has the latest name_rec_type as 'Assignment' - I do not care what the earlier records contained. help please, Anoop On 6/2/05, Anoop kumar V [EMAIL PROTECTED] wrote: Hi mysql-ers, I need help in a basic query: I have this table: select * from

Re: Need help in basic query

2005-06-02 Thread mfatene
(0.02 sec) Mathias Selon Anoop kumar V [EMAIL PROTECTED]: Hi mysql-ers, I need help in a basic query: I have this table: select * from isr2_aud_log where id_secr_rqst IN ('TASK23C6054B9D416C08:1284FD4:103FB047DF1:-7ECF') --and name_rec_type = 'Assignment' order by id_secr_rqst, dt_aud_rec

Need help forming SQL query

2005-01-20 Thread Mike Zornek
I have the following query which will get me all of the emails for my current membership: SELECT email.email_address FROM member, email WHERE member.member_primary_email_id = email.email_id AND member.member_standing != Dropped ORDER BY email.email_address I also have a query which will get me

Re: Need help forming SQL query

2005-01-20 Thread Rhino
clearly with only the column names. Rhino - Original Message - From: Mike Zornek [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Thursday, January 20, 2005 11:01 AM Subject: Need help forming SQL query I have the following query which will get me all of the emails for my current

Re: Need help forming SQL query

2005-01-20 Thread Mike Zornek
| text | | | | | ++--+--+-+-+ - Original Message - From: Mike Zornek [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Thursday, January 20, 2005 11:01 AM Subject: Need help forming SQL query

Re: Need help forming SQL query

2005-01-20 Thread SGreen
Mike Zornek [EMAIL PROTECTED] wrote on 01/20/2005 11:01:38 AM: I have the following query which will get me all of the emails for my current membership: SELECT email.email_address FROM member, email WHERE member.member_primary_email_id = email.email_id AND member.member_standing !=

Re: Need help forming SQL query

2005-01-20 Thread Rhino
Cc: Rhino [EMAIL PROTECTED] Sent: Thursday, January 20, 2005 11:26 AM Subject: Re: Need help forming SQL query On 1/20/05 11:16 AM, Rhino [EMAIL PROTECTED] wrote: You should *ALWAYS* indicate which version of MySQL you are using when you ask this sort of question; the answers is almost

need help with a query

2004-08-25 Thread Redmond Militante
hi i need advice on a query i'm trying to do. i'm trying to find entries with that are about to expire. entries expire if their date of submission is older than 60 days. i want to find all entries with a date of submission greater than 30 days, or those that are going to expire within a

RE: need help with a query

2004-08-25 Thread David Perron
on the 1 MONTH part, but I think it's the right track. -Original Message- From: Redmond Militante [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 25, 2004 6:03 PM To: [EMAIL PROTECTED] Subject: need help with a query hi i need advice on a query i'm trying to do. i'm trying to find

Re: need help with a query

2004-08-25 Thread Michael Stassen
Redmond Militante wrote: hi i need advice on a query i'm trying to do. i'm trying to find entries with that are about to expire. entries expire if their date of submission is older than 60 days. i want to find all entries with a date of submission greater than 30 days, or those that are going

Re: need help with a query

2004-08-25 Thread Michael Stassen
David Perron wrote: Are you assuming that all months have 30 days? You can use the same syntax with INTERVAL 1 MONTH True. I would also format the date comparison to use the same precision that the DATE_ADD function outputs. Why would you do that? The date column contains a DATE. CURDATE()

Re: need help with a query

2004-08-25 Thread Redmond Militante
PM To: [EMAIL PROTECTED] Subject: need help with a query hi i need advice on a query i'm trying to do. i'm trying to find entries with that are about to expire. entries expire if their date of submission is older than 60 days. i want to find all entries with a date of submission

Re: need help for a query

2004-08-24 Thread Stephen E. Bacher
select name from mytable a where changedate (select changedate from mytable b where a.name=b.name and a.changedate != b.changedate); or: select name from mytable a where exists (select * from mytable b

need help for a query

2004-08-23 Thread Claire Lee
Hi, Here's a table of mine namedate changeDate n1d1 cd1 n2d1 cd3 n2d2 cd1 n4d1 cd2 n1d2 cd5 n5d1 cd4 n6d2 cd2 I need to select every name for which the changeDate corresponding

Re: need help for a query

2004-08-23 Thread Matt Warden
Hi Claire, On Mon, 23 Aug 2004 14:52:29 -0700 (PDT), Claire Lee [EMAIL PROTECTED] wrote: Hi, Here's a table of mine namedate changeDate n1d1 cd1 n2d1 cd3 n2d2 cd1 n4d1 cd2 n1d2 cd5 n5d1

need help in sql query

2004-07-21 Thread Kapoor, Nishikant
Hello List, I have a problem that I am looking your help for. Would greatly appreciate it. Here is what I am trying to do: create table C (cId tinyint(4), cName varchar(10)); insert into C values (1,'Cat01'), (2,'Cat02'), (3,'Cat03'), (4,'Cat04'); create table SC (scId tinyint(4), cId

Re: need help in sql query

2004-07-21 Thread SGreen
You were so very close to getting what you wanted! What is causing the problem is the comma (,) in your FROM clause. MySQL permits two methods of declaring an INNER JOIN. The first is by using the keyphrase INNER JOIN the second is with a comma in your table list. Here is how to rephrase your

need help with a query

2004-03-25 Thread Anders Gjermshus
Hi. I'm having trouble with a query. I'm wondering if it is possible at all. I'm making a poll for my webpage. I have two tables: Poll and poll_votes Table poll contains data about the poll Poll_Votes contains all the votes. What I want is to pull out data about the poll and if the user

Re: need help with a query

2004-03-25 Thread Ligaya Turmelle
sounds like you need a join. Select * from Poll, poll_votes where (Poll.poll_id = poll_votes.poll_id) and (poll_votes.user_ID = WHATEVER); But I'm still a beginner so Respectfully, Ligaya Turmelle Anders Gjermshus [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi. I'm having

Re: Need help with a query

2003-12-28 Thread Roger Baklund
* Soheil Shaghaghi Hello everyone, I need help with MySQL coding in php please if anyone can help. I can try. :) I have 3 tables: -users, where the user info is stored. -awards: contains the list of all the awards for each user -award_types: contains different types of award The tables

Need help with a query

2003-12-27 Thread Soheil Shaghaghi
Hello everyone, I need help with MySQL coding in php please if anyone can help. I have 3 tables: -users, where the user info is stored. -awards: contains the list of all the awards for each user -award_types: contains different types of award The tables are at the bottom of the page. What I

Need help with a query..

2003-12-22 Thread Tibby
Hi ppl, I have already tried the 'rtfm', but it just didn't help. I have a table: +-++--+ | key | desc| value | +-++--+ | 1 | book| 4 | | 2 | book| 7 | | 3 | book| 5 | | 4 | pen | 4 | | 5 | pen

Re: Need help with a query..

2003-12-22 Thread Chuck Gadd
Tibby wrote: ..and I want to get this with a single query: +-++--+ | key | desc| value | +-++--+ | 2 | book| 7 | | 6 | pen | 7 | +-++--+ I need to get only one row from col. DESC, the one with the highest VALUE.

Re: Need help with a query..

2003-12-22 Thread Aleksandar Bradaric
Hi, I have already tried the 'rtfm', but it just didn't help. But it's right there :) 3.5.2 The Row Holding the Maximum of a Certain Column ..and I want to get this with a single query: +-++--+ | key | desc| value | +-++--+ | 2 | book|

Re[2]: Need help with a query..

2003-12-22 Thread Aleksandar Bradaric
Hi, select key, desc, value from your_table t1 where value = (select max(value) from your_table where desc = t1.desc) Anyway, when i execute this query, i get an error near 'select max(value)'... :( It's because the subselects are supported from version 4.1. If you use older MySQL

Re: Need help with a query..

2003-12-22 Thread Roger Baklund
* Aleksandar Bradaric select key, desc, value from your_table t1 where value = (select max(value) from your_table where desc = t1.desc) Anyway, when i execute this query, i get an error near 'select max(value)'... :( It's because the subselects are supported from version 4.1.

Re: Need Help With MySQL Query

2003-02-16 Thread Michael T. Babcock
Veysel Harun Sahin wrote: select vanNumber, sum(grossPay) from usertableDaily group by vanNumber; The above is the correct query, to save yourself some time. As for your problem: But when I execute I get this: Resource id#3 Resource id#4 This means you're using a resource

Need Help With MySQL Query

2003-02-15 Thread Guru Geek
hello, I've performed searches on this site and php.net to try and figure out why this is occuring. I can't find any instance in my searches that helped me. So, I'm posting my very first question to this list Here's my table ($usertableDaily): vanNumber|grossPay -

Re: Need Help With MySQL Query

2003-02-15 Thread Veysel Harun Sahin
select vanNumber, sum(grossPay) from usertableDaily group by vanNumber; [EMAIL PROTECTED] wrote: hello, I've performed searches on this site and php.net to try and figure out why this is occuring. I can't find any instance in my searches that helped me. So, I'm posting my very first question

Re: Need Help With MySQL Query

2003-02-15 Thread Simon Windsor
Hi Interesting problem, normally to get a total by type, you would have a query like, select van, sum(pay) from ($usertableDaily) group by van; However you are individually quering each total, your approach is correct, but slower. The problem you have though is the return of Resource

Re: Need Help With MySQL Query

2003-02-15 Thread Jerry
[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 15, 2003 10:09 AM Subject: Need Help With MySQL Query hello, I've performed searches on this site and php.net to try and figure out why this is occuring. I can't find any instance in my searches that helped me. So, I'm posting

Need help with a query, joins, etc.

2003-01-15 Thread Chad Day
I had a query that was working fine before for a sports project .. basically, 3 tables .. one stored goal data, one stored team data, and the other player data. To get all the scoring data (player names, jersey #'s), I left joined to the player table 3 different times (on GOAL, ASSIST1, and

Need help optimizing a query

2002-02-13 Thread david
I need to optimize the following query: SELECT user, sum(in), sum(out) FROM stats WHERE from='20020205' AND to='20020206' GROUP BY user; In,out are bigint, user is varcher(20) and from,to are timestamp And I want to speed up this type of query, but I have not been able to to get it to use an

Re: Need help with a query ...

2001-11-04 Thread Anvar Hussain K.M.
Hi John Kelly, This is not a perfect solution but may be useful to you. But still with two queries! From Mysql prompt issue these two queries. SELECT @maxcat := max(Category) FROM table WHERE category = 'Sports:Football:Players' OR category = 'Sports:Football' OR category = 'Sports'; Select

Need help with a query ...

2001-11-02 Thread John Kelly
Hi, I have a MySQL table with a column that contains some of a web site directory's category names in the format: Sports:Football:Players I am trying to build a query that that locates all records that match the above category name OR if none exist its parent Sports:Football OR if none exist

Re: Need help with a query ...

2001-11-02 Thread Michael
You need to use the LIKE command I think. The MySQL manual should give you all the details. If you need further help I can just write the whole query out for you. Or was the problem that you only want to worry about the if..then stuff if needed? If so could you tell what your pulling back from

Re: Need help with a query ...

2001-11-02 Thread John Kelly
] Cc: [EMAIL PROTECTED] Sent: Friday, November 02, 2001 7:09 PM Subject: Re: Need help with a query ... You need to use the LIKE command I think. The MySQL manual should give you all the details. If you need further help I can just write the whole query out for you. Or was the problem that you

Re: Need help with a query ...

2001-11-02 Thread Bob Hall
On Fri, Nov 02, 2001 at 06:15:08PM -0800, John Kelly wrote: Hi, I have a MySQL table with a column that contains some of a web site directory's category names in the format: Sports:Football:Players I am trying to build a query that that locates all records that match the above category