Re: Select question

2007-10-25 Thread Ralf Hüsing
Matthew Stuart schrieb: I've got this statement to select the last two entries in my db: SELECT top 2 * FROM Content ORDER BY ContentID desc and it works fine because it selects the last two items entered into the db. However, I only want to be able to select item 2 rather than both 1

RE: Select question

2007-10-25 Thread Jerry Schwartz
Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com -Original Message- From: Matthew Stuart [mailto:[EMAIL PROTECTED] Sent:

Re: Select question

2007-05-17 Thread Peter Brawley
Erich, Is there a way to set a prefix for each table so that the results come out like tablename.column? Use a scripting or application language to automate parameterise query generation. SQL is just a partial computing language. PB - Erich C. Beyrent wrote: I have three tables, all

Re: SELECT question - query for records over a series of dates

2005-08-17 Thread Dan Tappin
I think you might be one to something here... is there such a thing as a while loop in MySQL? i.e. can I fill a table with data via a MySQL query? I guess I could do it via PHP... I could create a temp table with one column of dates for the range I am looking for and then LEFT JOIN my

Re: SELECT question - query for records over a series of dates

2005-08-17 Thread Michael Stassen
Dan Tappin wrote: I think you might be one to something here... is there such a thing as a while loop in MySQL? i.e. can I fill a table with data via a MySQL query? I guess I could do it via PHP... I could create a temp table with one column of dates for the range I am looking for and

Re: SELECT question - query for records over a series of dates

2005-08-16 Thread Daniel Kasak
Dan Tappin wrote: I have a table full of data... a log of sorts. Each row has a timestamp. I want to generate some reports based on this data. For example I want a COUNT(*) of the rows for each day for the past week, 30 days, 12 months etc. I have no problem generating the query but I

Re: SELECT question - query for records over a series of dates

2005-08-16 Thread Michael Stassen
Dan Tappin wrote: I have a table full of data... a log of sorts. Each row has a timestamp. I want to generate some reports based on this data. For example I want a COUNT(*) of the rows for each day for the past week, 30 days, 12 months etc. I have no problem generating the query but I am

RE: SELECT question

2004-12-29 Thread Jay Blanchard
[snip] I know to most of you this will seem like a mundane question, but I was hoping someone can tell me how to select the last record in a table that meets certain criteria. Like to see who hosted the last party in CHicago. SELECT host FROM PARTY WHERE city=chicago; PARTY ID |host | city |

Re: SELECT question

2004-12-29 Thread DreamWerx
ORDER BY host DESC LIMIT 1 On Wed, 29 Dec 2004 14:18:02 -0800 (PST), Richard Reina [EMAIL PROTECTED] wrote: I know to most of you this will seem like a mundane question, but I was hoping someone can tell me how to select the last record in a table that meets certain criteria. Like to see who

Re: Select Question

2004-10-05 Thread Michael Stassen
If you have mysql 4.1, you can use GROUP_CONCAT(). SELECT id, GROUP_CONCAT(f2) FROM yourtable GROUP BY id; See the manual for details http://dev.mysql.com/doc/mysql/en/GROUP-BY-Functions.html. Michael Feghhi, Jalil wrote: Is there a way to convert the following result set: id f2

Re: Select Question

2004-10-05 Thread SGreen
Check out the GROUP_CONCAT() function, see if this help: http://dev.mysql.com/doc/mysql/en/GROUP-BY-Functions.html Shawn Green Database Administrator Unimin Corporation - Spruce Pine Feghhi, Jalil [EMAIL PROTECTED] wrote on 10/05/2004 11:20:21 AM: Is there a way to convert the following

Re: Select Question

2004-10-05 Thread Giulio
If your MySQL version is 4.1 or later, you could try GROUP_CONCAT the query should be ( not tested ): select id,GROUP_CONCAT(f2) from tablename group by id regards, Giulio Il giorno 05/ott/04, alle 17:20, Feghhi, Jalil ha scritto: Is there a way to convert the following result set: id

Re: SELECT question

2004-09-21 Thread Andre Matos
Hi Roger, I took the suggestion from Brad Eacker and use BETWEEN and now works without problem. However, I decided to do a couple more tests and what I found was that the problem occurs on MySQL version 4.0.18-standard using InnoDB on Linux but does not occur on Mac OS X using the same MySQL

Re: SELECT question

2004-09-20 Thread Roger Baklund
* Andre Matos I am performing a SELECT and I am getting 0 rows when I run the SELECT direct in the MySQL database and getting 1 when I run using PHP. This is my select: SELECT * FROM scan WHERE TimePointID = 3 AND ScanQCResult = 'n' AND (ScanStatusID 90 OR ScanStatusID 98); Looks ok. I

Re: SELECT question

2004-09-20 Thread beacker
Andre Matos writes: SELECT * FROM scan WHERE TimePointID = 3 AND ScanQCResult = 'n' AND (ScanStatusID 90 OR ScanStatusID 98); I realized latter analyzing this select that I made a mistake using OR at this point: (ScanStatusID 90 OR ScanStatusID 98), it should be AND. The second rendition

RE: SELECT Question

2003-10-22 Thread Barry Byrne
-Original Message- From: Jean-Pierre Schwickerath [mailto:[EMAIL PROTECTED] Hello Mumba, Hello Barry, How do I select out and filter only rows that match both 16 and 62 in the KEYW_ID col? IE. The query would return only 119 and 108? I'm sure this could be done more

RE: SELECT Question

2003-10-20 Thread Barry Byrne
-Original Message- From: Mumba Chucks [mailto:[EMAIL PROTECTED] I've been given a table to work with, and I'm not meant to change it: - | TABLE_NAME | TBL_IDX | KEYW_ID | - | PROPERTIES | 108 | 16

Re: SELECT Question

2003-10-20 Thread Jean-Pierre Schwickerath
Hello Mumba, Hello Barry, How do I select out and filter only rows that match both 16 and 62 in the KEYW_ID col? IE. The query would return only 119 and 108? I'm sure this could be done more effeciently other ways, possibly with a sub select if available, but something like this

Re: Select question

2003-02-10 Thread Diana Soares
Note that you're ordering by goals, not MAX(goals). That's why you're not getting the results expected. Try: SELECT manager.name, position, MAX(goals) as goals FROM roster JOIN reference JOIN manager WHERE manager.idn=reference.idn AND reference.idp=roster.idp AND position like 'F' GROUP BY

Re: Select question

2003-02-09 Thread C. Reeve
Hi again, After some struggling, I have managed to get the problem below 99% working, the problem now is that I can't get them in descending order. Here is my select statement. $query = select manager.name, position, MAX(goals) from roster join reference join manager where

RE: select question

2002-12-07 Thread Adolfo Bello
Use the CONCAT function Adolfo -Original Message- From: tag [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 3:57 AM To: [EMAIL PROTECTED] Subject: select question HI, I need to do a select query that can do the following: select * from table where col1 like

Re: select question

2002-12-06 Thread Roger Baklund
* tag I need to do a select query that can do the following: select * from table where col1 like hex(somestring); This was a bit confusing... :) hex(somestring) will always return 0, unless the string is a numerical value: mysql select hex('65'),hex(65),hex(A);

Re: select question

2002-12-06 Thread Roger Baklund
* Tonino Greco Thanks - but I got it working : select * from table where col1 like concat(%, hex(somestring), %); the hex(somestring) - returns :736F6D65737472696E67 * me hex(somestring) will always return 0, unless the string is a numerical value Sorry for that, this was changed in 4.0.1,

re: Select question

2002-09-10 Thread Egor Egorov
Elin, Tuesday, September 10, 2002, 12:03:21 PM, you wrote: ER I have a table called users with the columns firstname and lastname. I would ER like to do a search on the fullname and have tried: ER select * from users where (firstname + ' ' + lastname) = John Smith ER which returns all rows for

Re: Select question

2002-09-10 Thread Nicholas Stuart
You would have to do something like: SELECT * FROM users WHERE CONCAT(firstname, , lastname) = John Smith That should get you what you want. If your taking your DB from MS SQL to MySQL only a few queries will port directly over. You have to be careful that you follow the MySQL syntax and

Re: SELECT Question.

2002-03-02 Thread BD
At 01:22 AM 3/3/2002 , you wrote: I need to pull a variable number of fields from a table from the last inputted fields. For example, instead of doing something like SELECT * FROM table I am looking for a way to do something like this(hypothetical, I don't really know what I should do).

Re: SELECT question.

2001-05-31 Thread Scott Alexander
On 30 May 2001, at 10:14, Paul DuBois wrote: At 9:41 AM -0700 5/30/01, Richard Reina wrote: I am stuck on a select query and was wondering if someone could help. I have I've written a database app. that helps me run my business (trucking). I need however to write a query that shows me all

Re: SELECT question.

2001-05-30 Thread Rafal Jank
Richard Reina wrote: I am stuck on a select query and was wondering if someone could help. I have I've written a database app. that helps me run my business (trucking). I need however to write a query that shows me all of the loads that are delivered but not billed (invoiced). Which

RE: SELECT question.

2001-05-30 Thread Ravi Raman
hi. left join the two tables then check for NOT NULL in one of the fields from invoiced that will be empty if they haven't been invoiced: SELECT l.load_no l.date FROM loads l LEFT JOIN invoiced i on l.load_no = i.load_no where i.invoiced_on_this_date IS NULL obviously, substitute a real column

Re: SELECT question.

2001-05-30 Thread Mohammad Shoja
I am stuck on a select query and was wondering if someone could help. I have I've written a database app. that helps me run my business (trucking). I need however to write a query that shows me all of the loads that are delivered but not billed (invoiced). Which means that I have to

Re: SELECT question.

2001-05-30 Thread Paul DuBois
At 9:41 AM -0700 5/30/01, Richard Reina wrote: I am stuck on a select query and was wondering if someone could help. I have I've written a database app. that helps me run my business (trucking). I need however to write a query that shows me all of the loads that are delivered but not billed

RE: SELECT question.

2001-05-30 Thread Johnson, Gregert
SELECT l.load_no, l.date FROM loads l LEFT OUTER JOIN invoiced i ON l.load_no = i.load_no WHERE l.dlvr_date 0 AND i.load_no IS NULL; -- Greg Johnson -Original Message- From: Richard Reina [mailto:[EMAIL PROTECTED]] Sent: Wednesday,

Re: SELECT question.

2001-05-30 Thread Richard Reina
Thank you to all who responded. A left join was definately the answer. Richard Roger Karnouk wrote: Try this SELECT l.load_no l.date FROM loads l left join invoice i on (l.load_no = i.load_no) where i.load_no is null AND l.dlvr_date 0; -Original Message- From: Richard

Re: Select Question

2001-04-13 Thread John Dean
Hi The short answer is no, but you could get around this by using JOIN Sub-queries are not yet supported At 21:39 12/04/2001 -0400, James Gonthier wrote: The following works ok in SQL Server, can it work in mySQL? select * from users where id in (select userid from group where name='sales')

Re: Select Question

2001-04-12 Thread Benjamin Pflugmann
Hi. On Thu, Apr 12, 2001 at 09:39:46PM -0400, [EMAIL PROTECTED] wrote: The following works ok in SQL Server, can it work in mySQL? select * from users where id in (select userid from group where name='sales') Sub-selects are not (yet) supported by MySQL. But you can rewrite that query to