Re: Problem in a very simple SQL statement

2005-03-11 Thread Mário Gamito
Arghh... shame on me forever. I'm speachless. Mikhail Entaltsev wrote: Missed FROM clause... ;) Best regards, Mikhail. - Original Message - From: "Mário Gamito" <[EMAIL PROTECTED]> To: Sent: Friday, March 11, 2005 1:49 PM Subject: Problem in a very simple SQL stateme

RE: Problem in a very simple SQL statement

2005-03-11 Thread Jay Blanchard
[snip] select count(email) where email='[EMAIL PROTECTED]'; [/snip] select count(email) FROM TABLE where email='[EMAIL PROTECTED]'; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Problem in a very simple SQL statement

2005-03-11 Thread Mikhail Entaltsev
Missed FROM clause... ;) Best regards, Mikhail. - Original Message - From: "Mário Gamito" <[EMAIL PROTECTED]> To: Sent: Friday, March 11, 2005 1:49 PM Subject: Problem in a very simple SQL statement > Hi, > > Why do i get an error on this statement: >

Problem in a very simple SQL statement

2005-03-11 Thread Mário Gamito
Hi, Why do i get an error on this statement: select count(email) where email='[EMAIL PROTECTED]'; The error is: "ERROR 1064: You have an error in your SQL syntax near 'where email='[EMAIL PROTECTED]'' at line 1" The statement seems pretty clear to me, but obviously something's wrong. What can it

Re: Simple SQL Question

2004-10-27 Thread Jeff Burgoon
Good one. I don't know how I missed this either! Thanks! "gerald_clark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What about > select distinct a.region, a.city > from mytable a , mytable b > where a.region=b.region and a.city <> b.city > > Jay Blanchard wrote: > > >[snip] >

Re: Simple SQL Question

2004-10-27 Thread Jay Blanchard
[snip] What about select distinct a.region, a.city from mytable a , mytable b where a.region=b.region and a.city <> b.city [/snip] Crud! Standing too close to the forest and forgot about a self join... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: Simple SQL Question

2004-10-27 Thread gerald_clark
What about select distinct a.region, a.city from mytable a , mytable b where a.region=b.region and a.city <> b.city Jay Blanchard wrote: [snip] Anybody? I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key

Re: Simple SQL Question

2004-10-27 Thread Jay Blanchard
[snip] Anybody? > > I have a simple problem and I'm just wondering the BEST query to solve it. > > I want to return all the rows of a table whose foreign key value exists > more > > than once in that table. IE... > > > > MyTable > > Region(foreign key)City > > EastB

Re: Simple SQL Question

2004-10-27 Thread Jeff Burgoon
Anybody? ""Jeff Burgoon"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorry, I forgot to mention I am using version 4.0.20a (no subqueries > supported) > > ""Jeff Burgoon"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I have a simple problem and I'm just wond

Re: Simple SQL Question

2004-10-22 Thread Jeff Burgoon
Sorry, I forgot to mention I am using version 4.0.20a (no subqueries supported) ""Jeff Burgoon"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a simple problem and I'm just wondering the BEST query to solve it. > I want to return all the rows of a table whose foreign key val

Simple SQL Question

2004-10-22 Thread Jeff Burgoon
I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key value exists more than once in that table. IE... MyTable Region(foreign key)City EastBaltimore EastPhil

Re: Found cause of crash - simple SQL statement.

2002-08-12 Thread Heikki Tuuri
William, - Original Message - From: "William R. Mussatto" <[EMAIL PROTECTED]> To: "Heikki Tuuri" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, August 12, 2002 10:29 PM Subject: Re: Found cause of crash - simple SQL statement. &g

Re: Found cause of crash - simple SQL statement.

2002-08-12 Thread William R. Mussatto
news, but I thougth I was following this and didn't notice any threads on it. On Mon, 12 Aug 2002, Heikki Tuuri wrote: > Date: Mon, 12 Aug 2002 20:52:14 +0300 > From: Heikki Tuuri <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Re: Found cause of crash - simple SQL statement

Re: Found cause of crash - simple SQL statement.

2002-08-12 Thread Heikki Tuuri
Julian, the crash probably means the table is corrupt. That is a very basic query you run. Difficult to believe in any bug in SQL itself. Please dump your tables. Then upgrade to MySQL-Max-3.23.51. It is best to use an official binary. Then run CHECK TABLE on the table statcache. What does it

Found cause of crash - simple SQL statement.

2002-08-12 Thread mysqlbug2
>Description: See previous bug report Mysql crashes when executing simple query: mysql> delete from statcache where spamdate < 1028304682; ERROR 2013: Lost connection to MySQL server during query Table def: CREATE TABLE statcache ( reportid int(10) unsigned NOT

Re: still not a simple sql-question ! ...

2002-07-17 Thread Mike
o_sessions GROUP BY iuser; +--+--+ | iuser | isession | ssession +--+--+ |41 |2 | wanted |42 |4 | wanted |43 |6 | wanted +--+--+ Mike mysql - Original Message - From: "Matthew Scarrow"

Re: still not a simple sql-question ! ...

2002-07-17 Thread Matthew Scarrow
Add the sSession field and put in the not wanteds and wanteds you will see that the 3 rows your query returns is the first ones in the list per iUser that are the not wanteds. The query somehow needs to select the second ones. This is where the problem comes in. -- Original Message ---

Re: still not a simple sql-question ! ...

2002-07-17 Thread denonymous
From: "Robo" <[EMAIL PROTECTED]> > Well, by now i have found a way to work around the problem, > still the problem is not solved, you may want continue thinking about it: > > start with this: > iSession iUser sSession > -- -- - > 1 41 no >

still not a simple sql-question ! ...

2002-07-17 Thread Robo
Well, by now i have found a way to work around the problem, still the problem is not solved, you may want continue thinking about it: start with this: iSession iUser sSession -- -- - 1 41 no 2 41 wanted 3

Re: not so simple sql-question?: ... O_Sessions AS first, O_Sessions AS second ...

2002-07-16 Thread Benjamin Pflugmann
Hi. On Wed 2002-07-17 at 03:21:34 +0200, [EMAIL PROTECTED] wrote: > SELECT * FROM O_Sessions AS first, O_Sessions AS second WHERE > first.iSession=MAX(second.iSession) AND first.iUser=second.iUser > > yes, nice idea, but in mySQL, grouping functions like MAX are only > allowed in SELECT ... FROM

RE: not so simple sql-question?: SELECT iSession FROM O_Sessions ORDER BY iSession DESC GROUP BY iUser

2002-07-16 Thread Cal Evans
ct: not so simple sql-question?: SELECT iSession FROM O_Sessions ORDER BY iSession DESC GROUP BY iUser thank's for your replies, but that did not help :-( this is the setting (also look below for example table): O_Sessions contains multilpe recordsets for iUser (let' say iUser=42). I want t

not so simple sql-question?: ... O_Sessions AS first, O_Sessions AS second ...

2002-07-16 Thread Robo
SELECT * FROM O_Sessions AS first, O_Sessions AS second WHERE first.iSession=MAX(second.iSession) AND first.iUser=second.iUser yes, nice idea, but in mySQL, grouping functions like MAX are only allowed in SELECT ... FROM, not in the WERE part :-( But i will remember this way to work around the G

Re: ??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP BY iUser

2002-07-16 Thread Mike
Have you tried something like this, SELECT iSession FROM O_Sessions GROUP BY iUser ORDER BY iSessions DESC; Mike - Original Message - From: "Robo" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 16, 2002 3:39 PM Subject: ??? Simple sql-question

not so simple sql-question?: SELECT iSession FROM O_Sessions ORDER BY iSession DESC GROUP BY iUser

2002-07-16 Thread Robo
thank's for your replies, but that did not help :-( this is the setting (also look below for example table): O_Sessions contains multilpe recordsets for iUser (let' say iUser=42). I want the last RECORDSET of this iUser=42, not the first. With GROUP BY, all the various recordsets with iUser=42 ar

RE: ??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP BY iUser

2002-07-16 Thread Satish Prabhu
Message- From: Robo [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 12:39 PM To: [EMAIL PROTECTED] Subject: ??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP BY iUser I want the latest (highest) iSession to be selected: SELECT iSession FROM O_Sessions GROUP BY iUser

Re: ??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP BY iUser

2002-07-16 Thread Keith C. Ivey
On 16 Jul 2002, at 21:39, Robo wrote: > I want the latest (highest) iSession to be selected: > > SELECT iSession FROM O_Sessions GROUP BY iUser > > Because of GROUP BY, allways the first(!) recordset for iUser is > selected. But i want the last recordset to be selected :-( I'm not sure wha

??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP BY iUser

2002-07-16 Thread Robo
I want the latest (highest) iSession to be selected: SELECT iSession FROM O_Sessions GROUP BY iUser Because of GROUP BY, allways the first(!) recordset for iUser is selected. But i want the last recordset to be selected :-( How can this be done ? (mySQL) (iSession ist the primary key => lat

Re: Fw: Simple SQL

2002-05-16 Thread Gabriel
Sampson, Peter wrote: > Gabriel. > > This works fine and the two tables talk to each other. > > BUT, > My website can have 5 - 10 news stories per month. So in the tblNews I > could have > [Snip multiple rows] > I need to use DISTINCT in the SQL lingo as I "bind" the recordset's > "nMonth"

RE: Fw: Simple SQL

2002-05-16 Thread Sampson, Peter
+ -Original Message- From: Peter Sampson [mailto:[EMAIL PROTECTED]] Sent: 16 May 2002 06:58 To: Sampson, Peter Subject: Fw: Fw: Simple SQL - Original Message - From: Gabriel <> To: Peter Sampson <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wed

FW: Simple SQL

2002-05-16 Thread Sampson, Peter
-Original Message- From: Sampson, Peter Sent: 16 May 2002 09:35 To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: FW: Simple SQL Roger et al. Thanks for your response in reference to MySQL Query I'm interested to find out more on how to do the fo

RE: Simple SQL

2002-05-15 Thread Roger Baklund
* Peter Sampson > Maybe it doesn't work because I'm using a SQL wizard in Ultradev, I'll try > your code in the HTML/ASP part of the webpage > > The table structure is > Month > Headline > Image > Caption > Content Peter, you say you're not a programmer, and I'll try to explain a little about the

Re: Simple SQL

2002-05-15 Thread Mark
- Original Message - From: "Peter Sampson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 15, 2002 9:06 PM Subject: Simple SQL > SQL beginner using Macromedia Ultradev. Can you help? > > Please be gentle I'm not a programmer! >

Re: Fw: Simple SQL

2002-05-15 Thread Gabriel
This was addressed privately, but that's not a big deal. :) (I forgot to hit reply-all. :P) Peter Sampson wrote: > So i change the properties of Month to Integer in tblNews? Say you have two tables: mysql> show tables; ++ | Tables_in_test | ++ | MonthNames

Re: Simple SQL

2002-05-15 Thread Peter Sampson
urhan Ozen <[EMAIL PROTECTED]> To: Peter Sampson <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, May 15, 2002 10:14 PM Subject: RE: Simple SQL > Peter, > Please give us more insight on this. Is the column where you store dates (or > months) is a date dat

Re: Simple SQL

2002-05-15 Thread Peter Sampson
- From: Gurhan Ozen <[EMAIL PROTECTED]> To: Peter Sampson <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, May 15, 2002 10:14 PM Subject: RE: Simple SQL > Peter, > Please give us more insight on this. Is the column where you store dates (or > months) is a date datatype

RE: Simple SQL

2002-05-15 Thread Gurhan Ozen
ssage- From: Peter Sampson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 15, 2002 3:06 PM To: [EMAIL PROTECTED] Subject: Simple SQL SQL beginner using Macromedia Ultradev. Can you help? Please be gentle I'm not a programmer! I am using Select DISTINCT Month FROM tblNews The problem i

Fw: Simple SQL

2002-05-15 Thread Peter Sampson
Month? > - Original Message - > From: Gabriel <[EMAIL PROTECTED]> > To: Peter Sampson <[EMAIL PROTECTED]> > Sent: Wednesday, May 15, 2002 8:32 PM > Subject: Re: Simple SQL > > > > Change the way you do your months. Instead of entering each month,

RE: Simple SQL

2002-05-15 Thread Roger Baklund
* Rodney Broom > From: Peter Sampson <[EMAIL PROTECTED]> > > Select DISTINCT Month > > FROM tblNews > > > > The problem is that the months are shown alphabetical not in > > calendar order. > > I'm assuming that your months are stored as names like: > > January, February, March > > or > >

Re: Simple SQL

2002-05-15 Thread Rodney Broom
From: Peter Sampson <[EMAIL PROTECTED]> > Select DISTINCT Month > FROM tblNews > > The problem is that the months are shown alphabetical not in calendar order. I'm assuming that your months are stored as names like: January, February, March or Jan, Feb, Mar If so, I think that sorting

Simple SQL

2002-05-15 Thread Peter Sampson
SQL beginner using Macromedia Ultradev. Can you help? Please be gentle I'm not a programmer! I am using Select DISTINCT Month FROM tblNews The problem is that the months are shown alphabetical not in calendar order. How can I change this? ---

RE: Simple SQL Query?

2001-07-18 Thread Gerlinde Fischer
At 16:02 17.07.01 +0100, Glenn Wearen wrote: > > select distinct PersonID > > from PersonProject > > where ProjectID != '2'; > > > > Is this what you are looking for? > > >No, what I'm looking for is... >SELECT PersonID >FROM PersonProject >AND PersonID NOT IN (SELECT PersonID >

RE: Simple SQL Query?

2001-07-17 Thread Glenn Wearen
That is exactly what I want, Thanks Rafal PS: does anybody know if there are plans to support nested queries in mySQL? > Hi, > maybe something like this: > select a.PersonId from PersonProject a left join PersonProject b > on(a.PersonID=b.PersonID and b.ProjectID=2) where b.PersonID > is null g

RE: Simple SQL Query?

2001-07-17 Thread Kent Hoover
Read all about Join in the manual -- it includes hints like this query: SELECT DISTINCT(PersonID) FROM PersonProject AS P1 LEFT JOIN PersonProject AS P2 ON P2.PersonID=P1.PersonID AND P2.ProjectID=2 WHERE P2.PersonID IS NULL; Cheers, Kent

RE: Simple SQL Query?

2001-07-17 Thread Glenn Wearen
> select distinct PersonID > from PersonProject > where ProjectID != '2'; > > Is this what you are looking for? No, what I'm looking for is... SELECT PersonID FROM PersonProject AND PersonID NOT IN (SELECT PersonID FROM PersonProjectID

RE: Simple SQL Query?

2001-07-17 Thread Simon Green
select distinct PersonID from PersonProject where ProjectID != '2'; Is this what you are looking for? Simon -Original Message- From: Glenn Wearen [mailto:[EMAIL PROTECTED]] Sent: 17 July 2001 14:18 To: '[EMAIL PROTECTED]' Subject: Simple SQL Query? How can

Simple SQL Query?

2001-07-17 Thread Glenn Wearen
How can I get a list of all PersonID's who are not in ProjectID 2 (i.e. PersonID 3 and 4)? Table: PersonProject PersonID| ProjectID --- 1 | 1 2 | 1 3 | 1 1 | 2 2 | 2 1 | 3 2

A simple SQL SELECT

2001-07-16 Thread Jeff S Wheeler
ments, Inc http://www.five-elements.com/~jsw/ database sql query table In article <[EMAIL PROTECTED]>, "Martin Boudreau" <[EMAIL PROTECTED]> wrote: > Hello there, > > I have a problem making a simple SQL query > > Let's say I have a table of hockey play

Re: simple SQL question

2001-01-29 Thread Gábor Lénárt
On Fri, Jan 26, 2001 at 12:42:51PM +1300, Quentin Bennett wrote: > Hi, > > how about > > select fname, c1.cname, c2.cname, c3.cname from > firms, > cityname as c1, > cityname as c2, > cityname as c3 > where > first.city0 = c1.id and > first.city1 = c2.id and > first.city2 = c3.id; > > CC'ing

RE: simple SQL question

2001-01-25 Thread Quentin Bennett
t you made of it, allowing others, like me, to suggest other solutions. Regards Quentin -Original Message- From: Gábor Lénárt [mailto:[EMAIL PROTECTED]] Sent: Friday, 26 January 2001 09:20 To: Gerald L. Clark Cc: [EMAIL PROTECTED] Subject: Re: simple SQL question On Thu, Jan 25, 2001 at

Re: simple SQL question

2001-01-25 Thread Gábor Lénárt
On Thu, Jan 25, 2001 at 12:52:11PM -0600, Gerald L. Clark wrote: > I would suggest not having 2 cities in your firm record, and making > fname,city your key. > > select * from firms order by fname,city would give you. > A+B company Dallas > A+B company London > New systems Ltd New York

Re: simple SQL question

2001-01-25 Thread Gerald L. Clark
[EMAIL PROTECTED] wrote: > > Hi, > > Sorry for the possible offtopic question I'm going to ask. > > I have got something similar (this is very simplicated situation of > my problem but this is the core of my headache): > > CREATE TABLE cityname ( > id BIGINT NOT NULL AUTO_INCREMEN

simple SQL question

2001-01-25 Thread lgb
Hi, Sorry for the possible offtopic question I'm going to ask. I have got something similar (this is very simplicated situation of my problem but this is the core of my headache): CREATE TABLE cityname ( id BIGINT NOT NULL AUTO_INCREMENT, cname CHAR(50), INDEX i