RE: SQL query taking a long time...please

2005-08-02 Thread mos
At 01:58 PM 8/2/2005, you wrote: Just wondering if someone would be kind enough to take a look at it - Nishi Nishi, What did EXPLAIN show? Also what happens if you have just one Match? Is it faster? If so, why not run 2 queries and build a temporary table from the results. Using OR

RE: SQL query taking a long time...please

2005-08-02 Thread SGreen
Kapoor, Nishikant [EMAIL PROTECTED] wrote on 08/02/2005 02:58:08 PM: Just wondering if someone would be kind enough to take a look at it - Nishi -Original Message- Following query is taking a long time (upto 10 secs) to return the resultset. Would greatly appreciate if someone

RE: SQL query taking a long time...please

2005-08-02 Thread Kapoor, Nishikant
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 02, 2005 3:14 PM To: Kapoor, Nishikant Cc: mysql@lists.mysql.com Subject: RE: SQL query taking a long time...please Kapoor, Nishikant [EMAIL PROTECTED] wrote on 08/02/2005 02:58:08 PM: Just

MySQL coredumps on FreeBSD if the SQL query contains a regexp expression

2005-03-10 Thread Daniel S. Haischt
Description: I am using MySQL 5.x on FreeBSD 5.4-PRE together with libpthread. These are the knobs I did provide to make (to compile the actual FreeBSD port): FORCE_PKG_REGISTER=yes \ WITH_OPENSSL=yes \ BUILD_OPTIMIZED=yes \ WITH_PROC_SCOPE_PTH=yes If executing the following SQL query, mysqld

Re: help with an SQL query

2005-02-22 Thread Ian Sales (DBA)
Michael Satterwhite wrote: - As it is, all I can suggest is to JOIN on all 90 tables - and hope MySQL can handle the query - and that you can type all of them without error. Note that if you use a UNION query as you suggest above, you will get the last login FOR EACH DAY - not the overall last

SQL-Query problem

2005-02-22 Thread Joppe A
Hello all, Have a little problem with to make a sql-query as I want to have it... The problem is I need to check in 3 tables and count out and get it presentated per n_id like n_id counted 01 5 02 10 03 2 My tables look as follows... In sub: id n_id In us: id email

help with an SQL query

2005-02-21 Thread J S
help me to write an SQL query to do this please? Many thanks. Please let me know if you need anymore information. JS. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: help with an SQL query

2005-02-21 Thread J S
the date (which I could get from the table | name if the user's uid was present in there). | | Could anyone help me to write an SQL query to do this please? | | Many thanks. Please let me know if you need anymore information. Select u.uid, max(l.time) as lastLog ~ From user_table u join t20041209 l

Re: help with an SQL query

2005-02-21 Thread Michael Satterwhite
| | | | +--+--+--+-+-+---+ | | 11 rows in set (0.00 sec) | | | | The time column here gives the actual time the user logged on, but I | | would be happy just to know the date (which I could get from the table | | name if the user's uid was present in there). | | | | Could anyone help me to write an SQL query

Re: help with an SQL query

2005-02-21 Thread Harald Fuchs
| | +--+--+--+-+-+---+ 11 rows in set (0.00 sec) The time column here gives the actual time the user logged on, but I would be happy just to know the date (which I could get from the table name if the user's uid was present in there). Could anyone help me to write an SQL query to do this please

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

Re: I'd like to know SQL query for table description.

2005-01-18 Thread yoge
Try this query - show table status from YourDatabaseName; ninjajs wrote: Hi. ALL i have a database in MySQL. A middleware request to MySQL DB server. and then, result is table description. ex) dbms_type,table_name,column_name,data_type,data_size,constraint_type What SQL query can I get

RE: I'd like to know SQL query for table description.

2005-01-18 Thread Jay Blanchard
[snip] and then, result is table description. ex) dbms_type,table_name,column_name,data_type,data_size,constraint_type What SQL query can I get this information ? [/snip] DESCRIBE `tablename`; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe

Re: I'd like to know SQL query for table description.

2005-01-18 Thread Gleb Paharenko
,data_size,constraint_type What SQL query can I get this information ? thank you. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb

I'd like to know SQL query for table description.

2005-01-17 Thread ninjajs
Hi. ALL i have a database in MySQL. A middleware request to MySQL DB server. and then, result is table description. ex) dbms_type,table_name,column_name,data_type,data_size,constraint_type What SQL query can I get this information ? thank you. -- MySQL General Mailing List For list

Re: Calculating User Ranks (SQL Query Question)

2004-12-24 Thread Don Read
On 22-Dec-2004 Michael J. Pawlowsky wrote: I’m trying to come up with a more efficient method to do this. I have a table where people enter some info into the table. snip I would like to allow the users to be able to see where they stand rank wise with everyone else. Right now I

Calculating User Ranks (SQL Query Question)

2004-12-22 Thread Michael J. Pawlowsky
Im trying to come up with a more efficient method to do this. I have a table where people enter some info into the table. The more entries they add the more points they get. (1 point per entry). I would like to allow the users to be able to see where they stand rank wise with everyone else. Right

Re: Calculating User Ranks (SQL Query Question)

2004-12-22 Thread SGreen
Try this: CREATE TEMPORARY TABLE tmpRankings ( Rank int auto_increment, entries int, user_id int ) INSERT tmpRankings (points, user_id) SELECT count(1), user_id FROM sometablenamehere GROUP BY user_id ORDER BY entries DESC; This way the tmpRankings table contains an

Multiple table count in one sql-query

2004-11-24 Thread Martin Rytz
Hello People I should have the count from 3 tables in one query; something like this: select count(*) from table1 union select count(*) from table2 union select count(*) from table3 union; The Problem ist, that the query gives 3 results back (the count from table1, table2 and table3) BUT I

Re: Multiple table count in one sql-query

2004-11-24 Thread Rhino
- Original Message - From: Martin Rytz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 24, 2004 8:47 AM Subject: Multiple table count in one sql-query Hello People I should have the count from 3 tables in one query; something like this: select count(*) from

RE: Multiple table count in one sql-query

2004-11-24 Thread Guillaume Giroux
(@CNT:[EMAIL PROTECTED](*)) from table3) ORDER BY 1 DESC LIMIT 1 GG -Original Message- From: Rhino [mailto:[EMAIL PROTECTED] Sent: November 24, 2004 09:47 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Multiple table count in one sql-query - Original Message

Re: Multiple table count in one sql-query

2004-11-24 Thread Michael Stassen
Rhino wrote: - Original Message - From: Martin Rytz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 24, 2004 8:47 AM Subject: Multiple table count in one sql-query Hello People I should have the count from 3 tables in one query; something like this: select count(*) from

Re: sql query to return unique ids from a table of date stamped results

2004-11-06 Thread Gleb Paharenko
Hi. May be it will be helpful: http://dev.mysql.com/doc/mysql/en/TIMESTAMP_4.1.html Rob Keeling [EMAIL PROTECTED] wrote: I am trying to find the sql statement needed to extract, from a table of data with multiple instances of a id no, a list of unique id nos, picking the latest (by

Re: sql query to return unique ids from a table of date stamped results

2004-11-06 Thread Michael Stassen
For each ADNO, you want the row with Lastupdatetime equal to that group's MAX(Lastupdatetime) . This is a little bit tricky and a frequently asked question. There are 3 ways to do it documented in the manual http://dev.mysql.com/doc/mysql/en/example-Maximum-column-group-row.html. Michael Rob

Re: sql query to return unique ids from a table of date stamped results

2004-11-06 Thread Michael Stassen
How will that help? He already has a timestamp column. He's asking how to get the rows conataining the groupwise maximum timestamps. Michael Gleb Paharenko wrote: Hi. May be it will be helpful: http://dev.mysql.com/doc/mysql/en/TIMESTAMP_4.1.html Rob Keeling [EMAIL PROTECTED] wrote: I am

sql query to return unique ids from a table of date stamped results

2004-11-05 Thread Rob Keeling
I am trying to find the sql statement needed to extract, from a table of data with multiple instances of a id no, a list of unique id nos, picking the latest (by datestamp which is stored as a second field) so that a master list is updated. The application is a list of student photos, each

SQL Query Question

2004-08-14 Thread Michael J. Pawlowsky
Im not sure if this is possible or not. I have a Sales leads table. Part of the table has 2 employee_ids. 1. The Sales person the lead is assigned to. 2. The Marketing person that generated the lead. Then there is a employee table that has ids and names. When generating a report for leads I would

Re: SQL Query Question

2004-08-14 Thread Michael Stassen
You need to join the employee table twice, once for each id lookup, like this: SELECT es.name AS sales_name, em.name AS marketing_name, leads.id FROM leads JOIN employee es ON leads.salesid = es.id JOIN employee em ON leads.marketingid = em.id; Michael Michael J. Pawlowsky wrote:

Re: SQL Query Question

2004-08-14 Thread Michael J. Pawlowsky
Thanks a lot Michael. A regular join did not seem to work. But when I tried a LEFT JOIN it worked. A cut down example of it is the following. SELECT global_lead.id, rep_no, es.fname as sales_name, em.fname as marketing_name FROM global_lead LEFT JOIN global_employee es ON global_lead.rep_no =

Re: SQL Query Question

2004-08-14 Thread Michael Stassen
Right. If the employee ID in either the rep_no or entered_by columns does not have a corresponding row in the global_employee table, then the regular join won't match that row. In that case, as you found, you need a LEFT JOIN, which guarantees you get the rows from the table on the left, and

need help in sql query

2004-07-21 Thread Kapoor, Nishikant
(4), scName varchar(10)); insert into SC values (1, 1, 'SubCat01'), (2, 1, 'SubCat02'); create table T (tId tinyint(4), scId tinyint(4), cId tinyint(4), topic varchar(50)); insert into T values (1, 1, 1, 'Topic01'), (2, 1, 1, 'Topic02'); I am using the following sql query: SELECT C.cId, C.cName

Re: need help in sql query

2004-07-21 Thread SGreen
into T values (1, 1, 1, 'Topic01'), (2, 1, 1, 'Topic02'); I am using the following sql query: SELECT C.cId, C.cName, SC.scId, SC.scName, count(T.scId) as tCount FROM C left outer join SC on (C.cId = SC.cId), SC SC1 left outer join T on (SC1.scId = T.scId

RE: how to intersect resulting sets form sql query

2004-07-19 Thread Victor Pendleton
The INTERSECT keyword is not available in MySQL. You will have to compare the columns in your join syntax (or get creative?). -Original Message- From: L a n a To: [EMAIL PROTECTED] Sent: 7/18/04 8:20 PM Subject: how to intersect resulting sets form sql query Hello, I'm trying to find

Re: how to intersect resulting sets form sql query

2004-07-19 Thread SGreen
INTERSECT is not a MySQL keyword. If I read your logic correctly, you seem to want: SELECT * FROM table WHERE (field_a like '%keyword1%' OR field_b like '%keyword1%') AND (field_a like '%keyword2%' OR field_b like '%keyword2%') This statements tests that both keyword1 and keyword2

how to intersect resulting sets form sql query

2004-07-18 Thread L a n a
Hello, I'm trying to find a resulting set for searching two keywords, like: Select * from table where filed_a like '%keyword1%' OR field_b like '%keyword1%' INTERSECT (Select * from table where filed_a like '%keyword2%' OR field_b like '%keyword2%'). This statement gives an error in syntax. What

Re: Sql Query Issue

2004-07-13 Thread SGreen
] Sankarasubramaniacc: n Fax to: [EMAIL PROTECTED]Subject: Sql Query Issue

Sql Query Issue

2004-07-12 Thread Jeyabalan Murugesan Sankarasubramanian
Hi All, I migrated the data from Oracle to MySQL.The following query works fine with Oracle whereas in MySql its hanging. SELECT distinct caty.name, caty.c_id, caty.notes, count(distinct segs.in_id) as num FROM segs, caty, st_mbers, t_mbers, p_mbrs, pr_mbers where segs.c_id = caty.c_id and

Re: Sql Query Issue

2004-07-12 Thread Stefan Kuhn
This is an index problem. Your tables don't contain any indices except on PKs. This can't work, given the number of joins and table sizes. Read the doc about indices. Stefan Am Monday 12 July 2004 09:55 schrieb Jeyabalan Murugesan Sankarasubramanian: Hi All, I migrated the data from Oracle to

Re: Using SQL query to populate a html form select field

2004-06-26 Thread Frank Bax
At 07:52 PM 6/25/04, Kyle Texan wrote: I want to take 1 field in a mysql table and use that information to populate an html form select field instead of writing the html code, that way when data changes in that mysql field the form will always be in sync with the table? You need to use a

Using SQL query to populate a html form select field

2004-06-25 Thread Kyle Texan
I want to take 1 field in a mysql table and use that information to populate an html form select field instead of writing the html code, that way when data changes in that mysql field the form will always be in sync with the table? -- MySQL General Mailing List For list archives:

What does this sql query mean?

2004-06-04 Thread Louie Miranda
Hi, Im just a new comer on mysql and i was in the middle of debugging some codes that aint mine. I was stuck here. I could not figure what does this select do? Its complicated.. Can anyone help me out? select * from shopcart inner join items on shopcart.itemId = iip.itemId where

Re: What does this sql query mean?

2004-06-04 Thread David Griffiths
Louie, The inner-join is just joining the two tables, shopcart and items. I think iip is an alias for items, but the alias would normally come after the name of the tiems table. Another way to write the query is (assuming iip is an alias for items), SELECT * FROM shopcart, items iip WHERE

Re: What does this sql query mean?

2004-06-04 Thread Louie Miranda
Message - From: David Griffiths [EMAIL PROTECTED] To: Louie Miranda [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, June 04, 2004 3:44 PM Subject: Re: What does this sql query mean? Louie, The inner-join is just joining the two tables, shopcart and items. I think iip is an alias

Port SQL Query from Oracle to MySQL

2004-04-20 Thread Remi Mikalsen
Hello. I've got a tricky problem on my hands. It seems very easy, but I can't figure it out anyway, and I've already spent quite some time trying to solve it! I'm doing the whole thing under MySQL 4.0, which seems to be the real problem here! It doesn't support my query I wrote! Well, I

Re: Port SQL Query from Oracle to MySQL

2004-04-20 Thread Jochem van Dieten
Remi Mikalsen wrote: Car - | ID | IDBrand | IDModel | Year | Price | - Characteristic | ID | Description | CarCharacteristics | IDCar | IDCharac |

RE: SQL Query Question

2004-04-17 Thread Victor Pendleton
The you will need to use the second format. DATE_FORMAT(queue_time, '%Y%m%d') = CURRENT_DATE() -Original Message- From: Dirk Bremer (NISC) To: [EMAIL PROTECTED] Sent: 4/16/04 4:09 PM Subject: Re: SQL Query Question - Original Message - From: Victor Pendleton [EMAIL PROTECTED

Re: SQL Query Question

2004-04-17 Thread Michael Stassen
If you do any math on your column, no index on the column can be used. If possible, you should always try to write your condition so that the calculations are done on the value(s) to compare to, not on the column. So, assuming you have no rows with future timestamps, something like this

SQL Query Question

2004-04-16 Thread Dirk Bremer \(NISC\)
I have a simple table where one of the columns is named queue_time and is defined as a timestamp-type. I would like to query this table for all rows where the queue_time equals the current date. I an a newbie and have been wrestling with the docs for a solution. You help will be appreciated. Dirk

RE: SQL Query Question

2004-04-16 Thread Scott Purcell
This works for Oracle, give it a try, use any format you want for the MM/DD/YY area. select to_char(queue_time, 'MM/DD/YY'); Scott Purcell -Original Message- From: Dirk Bremer (NISC) [mailto:[EMAIL PROTECTED] Sent: Friday, April 16, 2004 2:55 PM To: [EMAIL PROTECTED] Subject: SQL

RE: SQL Query Question

2004-04-16 Thread Victor Pendleton
WHERE queue_time = Now() + 0 Are you wanting just the date or the datetime? -Original Message- From: Dirk Bremer (NISC) To: [EMAIL PROTECTED] Sent: 4/16/04 2:54 PM Subject: SQL Query Question I have a simple table where one of the columns is named queue_time and is defined as a timestamp

Re: SQL Query Question

2004-04-16 Thread Dirk Bremer \(NISC\)
- Original Message - From: Victor Pendleton [EMAIL PROTECTED] To: 'Dirk Bremer (NISC) ' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 16, 2004 15:06 Subject: RE: SQL Query Question WHERE queue_time = Now() + 0 Are you wanting just the date or the datetime? -Original

RE: SQL Query Question

2004-04-16 Thread Victor Pendleton
%m%d') = CURRENT_DATE() + 0 ...no index usage though -Original Message- From: Dirk Bremer (NISC) To: [EMAIL PROTECTED] Sent: 4/16/04 3:25 PM Subject: Re: SQL Query Question - Original Message - From: Victor Pendleton [EMAIL PROTECTED] To: 'Dirk Bremer (NISC) ' [EMAIL PROTECTED

Re: SQL Query Question

2004-04-16 Thread Dirk Bremer \(NISC\)
- Original Message - From: Victor Pendleton [EMAIL PROTECTED] To: 'Dirk Bremer (NISC) ' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 16, 2004 15:57 Subject: RE: SQL Query Question If your data is stored in the following format 2004-04-16 00:00:00 you can do WHERE

Re: SQL Query Question

2004-04-16 Thread Garth Webb
On Fri, 2004-04-16 at 14:09, Dirk Bremer (NISC) wrote: - Original Message - From: Victor Pendleton [EMAIL PROTECTED] To: 'Dirk Bremer (NISC) ' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 16, 2004 15:57 Subject: RE: SQL Query Question If your data is stored

SQL Query problem

2004-02-20 Thread Claire Lee
Hi All, I have a query problem here. Say I have a table with employee records of three different departments. If each department manager wants to see employee info of their own department. Three different queries will be needed. Is there a way that I can write one single query and let SQL decide

Re: SQL Query problem

2004-02-20 Thread Duncan Hill
On Friday 20 February 2004 15:19, Claire Lee wrote: Hi All, I have a query problem here. Say I have a table with employee records of three different departments. If each department manager wants to see employee info of their own department. Three different queries will be needed. Is there a

SQL Query help

2004-02-19 Thread Andy Fletcher
This is probably tediously basic for all you super whiz MySQL people but help me out if you can. I have 2 tables in my database (there will be more) table_Applics table_keywords I want to select columns of information from table_applics based on the ID results from table_keywords. something

Re: SQL Query help

2004-02-19 Thread unix
This is probably tediously basic for all you super whiz MySQL people but help me out if you can. I have 2 tables in my database (there will be more) table_Applics table_keywords I want to select columns of information from table_applics based on the ID results from table_keywords.

[Slightly OT] Tricky SQL Query

2004-02-17 Thread A. Clausen
I am trying to construct what is proving to be a somewhat tricky SQL query. I have a database in which wireless activity data is dumped. The following is a boiled down version of what the table and the contents may look like: Date,Unit,InputOctets,OutputOctets,AccountingID 2004-01-31 23:59:05,0E

Re: [Slightly OT] Tricky SQL Query

2004-02-17 Thread Garth Webb
On Tue, 2004-02-17 at 11:00, A. Clausen wrote: I am trying to construct what is proving to be a somewhat tricky SQL query. I have a database in which wireless activity data is dumped. The following is a boiled down version of what the table and the contents may look like: Date,Unit

Re: sloooow sql query

2004-02-11 Thread Ed Leafe
On Feb 11, 2004, at 1:47 AM, nyem wrote: It works fine on small number of rows, but when the table reaches 400 rows the time it took to execute the query was 16 sec. And my cpu shot up to 100% whenever I populate 1000 rows. What have I done wrong here? Did you try creating an index on the

sloooow sql query

2004-02-10 Thread nyem
Hello, I have this table which stores an ever changing price of items. CREATE TABLE shop ( article INT(4) UNSIGNED ZEROFILL NOT NULL default '', date DATE NOT NULL default '-00-00', price DOUBLE(16,2) NOT NULL default '0.00', KEY article (article,date) ); And I

Re: sloooow sql query

2004-02-10 Thread jabbott
Got any indexes? --ja On Wed, 11 Feb 2004, nyem wrote: Hello, I have this table which stores an ever changing price of items. CREATE TABLE shop ( articleINT(4) UNSIGNED ZEROFILL NOT NULL default '', date DATE NOT NULL default '-00-00', price

SQL query help required

2004-02-03 Thread Riaan Oberholzer
Hi, Background: I run a prediction league for soccer competitions. For every game, I want to show how many predictions were submitted per scoreline, ie. 10% said 1-0 20% said 0-1 30% said 2-3 etc. My prediction table has a predictionA and predicionB column with the submitted scores. Currently

Re: SQL query help required

2004-02-03 Thread Jigal van Hemert
- Original Message - From: Riaan Oberholzer [EMAIL PROTECTED] 2-0, 2-1, 2-2, 2-3 1-0, 1-1, 1-2, 1-3 0-0, 0-1, 0-2, 0-3 SELECT CONCAT(predictionA, '-', predictionB) AS score, COUNT(CONCAT(predictionA, '-', predictionB)) AS count FROM table WHERE CONCAT(predictionA, '-', predictionB)

Re: SQL Query Question

2004-01-20 Thread sulewski
Hello, For my final solution I decided to use the inner join method. The query is created dynamically based upon a user interface component that allows people to build queries using parenthesis, ands and or's. Plus there is another field that I didn't include in the original question so as

Re: SQL Query Question

2004-01-20 Thread sulewski
I think I figured out the time problem. If I make s2 in the or s1 and remove any instances of s2 it works very fast with the 'or'. Joe On Tuesday, January 20, 2004, at 09:50 AM, sulewski wrote: Hello, For my final solution I decided to use the inner join method. The query is created

SQL Query Question

2004-01-19 Thread sulewski
Okay, I think I'm missing something obvious. I have two tables Table 1 Table 2 ___ _ ID rdid vid ___ _ ID in table 1 links to rdid in table 2. This

Re: SQL Query Question

2004-01-19 Thread sulewski
PM Subject: SQL Query Question Okay, I think I'm missing something obvious. I have two tables Table 1 Table 2 ___ _ ID rdid vid ___ _ ID in table 1

Fwd: SQL Query Question

2004-01-19 Thread sulewski
do it? :) - Original Message - From: sulewski [EMAIL PROTECTED] To: Jamie Murray [EMAIL PROTECTED] Sent: Monday, January 19, 2004 4:41 PM Subject: Re: SQL Query Question I asked a similar question but this time it's different. Last time I was looking for places where the record in table 1

Re: SQL Query Question

2004-01-19 Thread Michael Satterwhite
On Monday 19 January 2004 13:17, sulewski wrote: Okay, I think I'm missing something obvious. I have two tables Table 1 Table 2 ___ _ ID rdid vid ___

Re: SQL Query Question

2004-01-19 Thread Jochem van Dieten
Michael Satterwhite said: On Monday 19 January 2004 13:17, sulewski wrote: Okay, I think I'm missing something obvious. I have two tables Table 1 Table 2 ___ _ ID rdid vid

RE: SQL Query Question

2004-01-19 Thread Lincoln Milner
- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 4:39 PM To: [EMAIL PROTECTED] Subject: Re: SQL Query Question Michael Satterwhite said: On Monday 19 January 2004 13:17, sulewski wrote: Okay, I think I'm missing something obvious. I have two tables Table 1

Re: SQL Query Question

2004-01-19 Thread sulewski
Jochem, I believe this works. This is also easy to build dynamically. The query is going to be generated based upon some user input. Thank you very much, Joe On Monday, January 19, 2004, at 04:38 PM, Jochem van Dieten wrote: Michael Satterwhite said: On Monday 19 January 2004 13:17,

RE: SQL Query Question

2004-01-19 Thread Jochem van Dieten
Lincoln Milner said: Or, if I'm not mistaken, you could do something like: SELECT t1.* FROM table1 t1, table2 t2 WHERE t1.id = t2.rdid AND t2.vid IN (46, 554) ; That should work No. You are back to square one where there should only be one record in t2 with a vid of either 46 or

Re: SQL Query Question

2004-01-19 Thread Michael Satterwhite
On Monday 19 January 2004 15:38, Jochem van Dieten wrote: So let's make it 2 fields: SELECT t1.* FROM table1 t1, table2 t2 INNER JOIN table2 t3 ON (t2.rdid = t3.rdid AND t2.vid = 46 AND t3.vid = 554) WHERE t1.rdid = t2.rdid Add GROUP BY/DISTINCT per your requirements.

Re: SQL Query Question

2004-01-19 Thread Jochem van Dieten
Michael Satterwhite said: On Monday 19 January 2004 15:38, Jochem van Dieten wrote: So let's make it 2 fields: SELECT t1.* FROM table1 t1, table2 t2 INNER JOIN table2 t3 ON (t2.rdid = t3.rdid AND t2.vid = 46 AND t3.vid = 554) WHERE t1.rdid = t2.rdid Add GROUP BY/DISTINCT

Re: SQL Query Question

2004-01-19 Thread Michael Satterwhite
On Monday 19 January 2004 16:30, Jochem van Dieten wrote: Michael Satterwhite said: On Monday 19 January 2004 15:38, Jochem van Dieten wrote: So let's make it 2 fields: SELECT t1.* FROM table1 t1, table2 t2 INNER JOIN table2 t3 ON (t2.rdid = t3.rdid AND t2.vid = 46 AND

Re: SQL Query Question

2004-01-19 Thread Jochem van Dieten
Michael Satterwhite wrote: On Monday 19 January 2004 16:30, Jochem van Dieten wrote: Michael Satterwhite said: On Monday 19 January 2004 15:38, Jochem van Dieten wrote: So let's make it 2 fields: SELECT t1.* FROM table1 t1, table2 t2 INNER JOIN table2 t3 ON (t2.rdid = t3.rdid AND t2.vid

SQL Query

2004-01-18 Thread Ian O'Rourke
Any idea what is wrong with the following: SELECT * From articles ORDER BY EntryDate DESC LIMIT 1,10 WHERE SectionID=1 I want to return all articles with a particular SectionID, ordered by EntryDate and then I want to pick the start point and list the next 10 from that. Obviously in the final

Re: SQL Query

2004-01-18 Thread Terry Riley
I think it should be: SELECT * FROM articles WHERE sectionID=1 ORDER BY Entrydate Desc LIMIT 1,10 Terry --Original Message- Any idea what is wrong with the following: SELECT * From articles ORDER BY EntryDate DESC LIMIT 1,10 WHERE SectionID=1 I want to return all

AW: SQL Query

2004-01-18 Thread Freddie Sorensen
] Betreff: SQL Query Any idea what is wrong with the following: SELECT * From articles ORDER BY EntryDate DESC LIMIT 1,10 WHERE SectionID=1 I want to return all articles with a particular SectionID, ordered by EntryDate and then I want to pick the start point and list the next 10 from

Re: SQL Query

2004-01-18 Thread Ian O'Rourke
From: Terry Riley [EMAIL PROTECTED] I think it should be: SELECT * FROM articles WHERE sectionID=1 ORDER BY Entrydate Desc LIMIT 1,10 Terry That would be correct. I'll have to watch out for that ordering in the future. What confused me is if you just have the Select, Order By and Where

RE: SQL Query

2004-01-18 Thread Peter Lovatt
SELECT * From articles WHERE SectionID=1 ORDER BY EntryDate DESC LIMIT 1,10 the where clause should be after the table name HTH Peter -Original Message- From: Ian O'Rourke [mailto:[EMAIL PROTECTED] Sent: 18 January 2004 11:22 To: [EMAIL PROTECTED] Subject: SQL Query Any idea what

Re: SQL Query

2004-01-18 Thread Bernard Clement
My guess will be that the where clause is misplaced. Try SELECT * From articles WHERE SectionID=1 ORDER BY EntryDate DESC LIMIT 1,10 PLS read URL: http://www.mysql.com/doc/en/SELECT.html On that page it is stated that: All clauses used must be given in exactly the order shown in the syntax

sql query for faceted classification system

2004-01-02 Thread Seamus R Abshere
dear fellow MySQL users, i am developing a photo gallery with php4/mysql4.0 that uses faceted classification. -my tables: photos(photoid) metadata(photoid,facetid) -to select all of the photoid's that are associated with either facetid 1 or 2: SELECT DISTINCT photos.* FROM photos,metadata

Re: sql query for faceted classification system

2004-01-02 Thread Roger Baklund
* Seamus R Abshere i am developing a photo gallery with php4/mysql4.0 that uses faceted classification. -my tables: photos(photoid) metadata(photoid,facetid) -to select all of the photoid's that are associated with either facetid 1 or 2: SELECT DISTINCT photos.* FROM

self-join, group by, single SQL query

2003-11-11 Thread Robert Citek
Hello all, Is there a way to do a self-join and a group by in a single SQL query? For example, I have an PurchaseOrder table (see below) and would like to know what was the most recent order-number for each customer and the amount of that order. So far, I have been able to do this in two

SQL query question

2003-11-11 Thread Paal Eriksen
Hi, i have the following query: SELECT person.name as Name, firmal.beskrivelse as Businessline, lokasjon.navn as Location FROM firmal INNER JOIN ( person INNER JOIN lokasjon ON person.lokid = lokasjon.lokid) ON firmal.firmalid = person.firmalid which will give me a list of Name, Businessline,

RE: SQL query question

2003-11-11 Thread Andy Eastham
] with the primary key of the person table. Andy -Original Message- From: Paal Eriksen [mailto:[EMAIL PROTECTED] Sent: 11 November 2003 12:11 To: [EMAIL PROTECTED] Subject: SQL query question Hi, i have the following query: SELECT person.name as Name, firmal.beskrivelse

RE: SQL query question

2003-11-11 Thread Paal Eriksen
So close, Thanks you very much Andy. I tried one similar to your suggestion, but didn't get quite the result i expected. Cheers Paal Ny versjon av Yahoo! Messenger Nye ikoner og bakgrunner, webkamera med superkvalitet og dobbelt så morsom

Re: self-join, group by, single SQL query

2003-11-11 Thread Roger Baklund
* Robert Citek Is there a way to do a self-join and a group by in a single SQL query? Yes, but I'm not sure if that is what you need... For example, I have an PurchaseOrder table (see below) and would like to know what was the most recent order-number for each customer and the amount

Re: SQL query question

2003-11-11 Thread Leo
: Paal Eriksen To: [EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 7:11 PM Subject: SQL query question SELECT person.name as Name, firmal.beskrivelse as Businessline, lokasjon.navn as Location FROM firmal INNER JOIN ( person INNER JOIN lokasjon ON person.lokid

Re: self-join, group by, single SQL query

2003-11-11 Thread Robert Citek
On Tuesday, November 11, 2003, at 03:06 PM, Roger Baklund wrote: * Robert Citek Is there a way to do a self-join and a group by in a single SQL query? See the max-concat trick, described here: URL: http://www.mysql.com/doc/en/example-Maximum-column-group-row.html Thanks for the tip. It looks

Syntax for SQL Query - used to work with Access

2003-10-23 Thread Trevor Sather
Hi This query used to work with an Access database: SELECT *, (SELECT COUNT (*) FROM Links WHERE Links.CAT_ID = Categories.CAT_ID AND LINK_APPROVED = 'Yes') AS LINK_COUNT FROM Categories ORDER BY CAT_NAME ASC Now that we've upgraded to MySQL, the same ASP script returns this error:

Re: Syntax for SQL Query - used to work with Access

2003-10-23 Thread Matt W
AND L.LINK_APPROVED='Yes') GROUP BY C.CAT_ID ORDER BY CAT_NAME Hope that helps. Matt - Original Message - From: Trevor Sather Sent: Thursday, October 23, 2003 6:49 PM Subject: Syntax for SQL Query - used to work with Access Hi This query used to work with an Access database: SELECT *, (SELECT

<    1   2   3   4   5   >