Re: SQL statement work in mysql4 but not mysql5

2006-10-10 Thread Peter Brawley
Jason following statement works in 4 but not 5 SELECT f.*, c.id as cat_id, c.position as cat_position, c.state as cat_state, c.name as cat_name, c.description as cat_desc, c.image, c.url, m.member_name as mod_name, m.member_id as mod_id, m.is_group, m.group_id, m.group_name, m.mid

Re: SQL statement work in mysql4 but not mysql5

2006-10-10 Thread Jo�o C�ndido de Souza Neto
I had this problem here and i change my query to: SELECT f.*, c.id as cat_id, c.position as cat_position, c.state as cat_state, c.name as cat_name, c.description as cat_desc, c.image, c.url, m.member_name as mod_name, m.member_id as mod_id, m.is_group, m.group_id, m.group_name, m.mid

RE: SQL Statement Help

2005-12-14 Thread Charles Walmsley
best wishes Ch -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 14 December 2005 19:22 To: Jesse Cc: mysql@lists.mysql.com Subject: Re: SQL Statement Help "Jesse" <[EMAIL PROTECTED]> wrote on 12/14/2005 02:03:22 P

Re: SQL Statement Help

2005-12-14 Thread SGreen
"Jesse" <[EMAIL PROTECTED]> wrote on 12/14/2005 02:03:22 PM: > Hello, > I need help building a SQL Statement. I'm currently using MySQL > 5.something. This one is kind of strange, and I can't seem to figure out > how to do it. > > I have a table named Participants. Each Participant is allowe

Re: SQL Statement Help

2005-12-14 Thread Martijn Tonies
> Hello, > I need help building a SQL Statement. I'm currently using MySQL > 5.something. This one is kind of strange, and I can't seem to figure out > how to do it. > > I have a table named Participants. Each Participant is allowed to bring up > to 5 Guests. Instead of putting the names in a

RE: SQL Statement Conversion

2005-11-04 Thread Gordon Bruce
If your MySQL server is a *nix system than table names are case sensitive. SELECT A.*, CASE CounselorOnly WHEN 1 THEN 'Yes' WHEN 0 THEN 'No' END AS CO FROM Activities A ORDER BY Activity I also just noticed, remove the "CO =" and add "AS CO" following the END

Re: SQL statement help

2005-10-17 Thread SGreen
"C.F. Scheidecker Antunes" <[EMAIL PROTECTED]> wrote on 10/16/2005 01:58:56 PM: > I actually forgot something. I need a two statements into one. The > reason is that table_two has multiple values, so I need the minimal ID > from table 2.Thanks. > > Maybe I am working too much here and tired to

Re: SQL statement help

2005-10-17 Thread Terence
Turn off your auto commit (if using innodb) and run the queries. See how many rows it updates and compare them. If it matches commit it. Else rollback. C.F. Scheidecker Antunes wrote: Another thing is that table2 might not have a match. C.F. Scheidecker Antunes wrote: I actually forgot somet

Re: SQL statement help

2005-10-16 Thread C.F. Scheidecker Antunes
Another thing is that table2 might not have a match. C.F. Scheidecker Antunes wrote: I actually forgot something. I need a two statements into one. The reason is that table_two has multiple values, so I need the minimal ID from table 2.Thanks. Maybe I am working too much here and tired to se

Re: SQL statement help

2005-10-16 Thread C.F. Scheidecker Antunes
I actually forgot something. I need a two statements into one. The reason is that table_two has multiple values, so I need the minimal ID from table 2.Thanks. Maybe I am working too much here and tired to see the right statement. J.R. Bullington wrote: I am not the smartest on the list, but

RE: SQL statement help

2005-10-16 Thread J.R. Bullington
I am not the smartest on the list, but I think this would do it for you. UPDATE table_one t1, table_two t2 SET t1.ID = t2.ID WHERE t2.num = t1.num AND t1.ID = 0 J.R. -Original Message- From: C.F. Scheidecker Antunes [mailto:[EMAIL PROTECTED] Sent: Sunday, October 16, 2005 1:45 PM To: my

Re: SQL statement generated from prepared statement

2005-08-19 Thread Darrell Cormier
On Thursday 18 August 2005 16:37, Gleb Paharenko wrote: > Hello. > > These links might be helpful: > http://dev.mysql.com/doc/mysql/en/query-log.html > http://dev.mysql.com/doc/mysql/en/debugging-client.html > http://dev.mysql.com/doc/mysql/en/debugging-server.html > > Use a fresh ver

Re: SQL statement generated from prepared statement

2005-08-19 Thread Gleb Paharenko
Hello. These links might be helpful: http://dev.mysql.com/doc/mysql/en/query-log.html http://dev.mysql.com/doc/mysql/en/debugging-client.html http://dev.mysql.com/doc/mysql/en/debugging-server.html Use a fresh version of MySQL, because old couldn't log queries from prep

RE: SQL statement

2004-03-24 Thread Matt Chatterley
Very straightforward if the new column is NULLable OR has a deterministic value, e.g. INSERT INTO newtable (col1, col2) SELECT col1, 1 FROM oldtable WHERE ID = xxx Or if NULLable: INSERT INTO newtable (col1) SELECT col1 FROM oldtable WHERE ID = xxx Equally you could populate 'col2' from an expr

Re: SQL Statement Help - Is this possible?

2003-12-11 Thread spamtrap
Mark, You can find your first missing date in MySQL 4.1.0(alpha) or higher, using sub-selects, something like this: SELECT MIN(DATEADD(LOAD_DATE,1)) AS MISSING_DATE FROM load_cntl AS A WHERE DATEDIFF(NOW(), LOAD_DATE) < 30 AND LOAD_DATE <> (SELECT MAX(LOAD_DATE) FROM load_cntl AS B) AND

Re: SQL statement

2003-07-27 Thread Jim McAtee
Either do two queries or suppress the display of customer information within your application code. I'd probably do two queries, especially if asking for a lot of customer info or there were potentially a large number of orders for a given customer. Doing a join in either case gives you a lot of

Re: SQL statement dilemna

2003-06-25 Thread Diana Soares
Hi, Since i don't know what is "played for Sussex in two separate spells" -- what's a spell ? (sorry) -- i assume it's a different period of time, but don't know how to calculate it. Ignoring the "spell", i did this: SELECT A.Playerid, A.Teamid, sum(if (A.Substitute=1,0,1)) not_a_substitute, sum(

Re: SQL Statement Problems (NOT IN)

2003-03-12 Thread Bruce Feist
Gopalarathnam V. wrote: Your sub-select query can be written as: select t1id from t1 left join t2 on t1id = t2id where t2id is null in MySQL. Too restrictive -- the original poster, Phil Dowson, wanted to find all t1 rows except those that have t2.t2gid = 194 (or some other t2gid value). The a

Re: SQL Statement Problems (NOT IN)

2003-03-12 Thread Gopalarathnam V.
Hi Alec- Your sub-select query can be written as: select t1id from t1 left join t2 on t1id = t2id where t2id is null in MySQL. The example is actually given in the MySQL manual itself (section 1.7.4.1). [EMAIL PROTECTED] wrote: I am trying to check a table to see if a value doesnt exist, and

Re: SQL Statement Problems (NOT IN)

2003-03-11 Thread gerald_clark
Phil Dowson wrote: Literally in MSSQL server you would have (but I cant use subselects) SELECT t1id FROM t1 WHERE t1id NOT IN (SELECT t2id FROM t2 WHERE t2gid = 192) SELECT t1id FROM t1 left join t2 ON t1.t1id =t2. t2id AND t2.t2gid = 192 WHERE t2.t2id IS NULL --

Re: SQL Statement Problems (NOT IN)

2003-03-11 Thread Phil Dowson
Quoting Bruce Feist <[EMAIL PROTECTED]>: > Phil Dowson wrote: > > >SELECT t1.t1id > >FROM t1 > >LEFT JOIN t2 ON t1.t1id = t2.t2id > >WHERE t2.t2gid <> 192 //an example of a gid I am using// > > > >This is close, it shows all the id's that exist in the t2 table without a > >t2.t2gid of 192, bu

Re: SQL Statement Problems (NOT IN)

2003-03-11 Thread Phil Dowson
Quoting Bruce Feist <[EMAIL PROTECTED]>: > Phil Dowson wrote: > > >>Looks like a syntax error to me. There is no t1id in t2. Also, the OR > >>is redundant; if no t2 row was found, both t2id and t2gid will be NULL, > >>so checking one of them suffices. Try > >> > >>SELECT t1.t1id > >> FROM t

Re: SQL Statement Problems (NOT IN)

2003-03-11 Thread Alec . Cawley
> I am trying to check a table to see if a value doesnt exist, and I > would prefer to use the NOT IN syntax, but that doesnt work for mysql. > I've been trying to construct a similar statement in MySQL, but I'm > coming up cold. > > t1 > 't1id' > '1' > '18' > '19' > > t2 > 't2id','t2gid' > '19',

Re: SQL statement in PHP

2001-02-16 Thread Gerald L. Clark
Matt Davis wrote: Check the manual. The manual shows where following from. > > Can anybody help with this > > If I put the following statement in PHP my browser tells me that there is an > error on the line. > > //create sql statement > $sql = "select Business_Name,Trading_Details

Re: SQL statement in PHP

2001-02-16 Thread Fred van Engen
On Fri, Feb 16, 2001 at 12:43:15PM -, Matt Davis wrote: > Can anybody help with this > > If I put the following statement in PHP my browser tells me that there is an > error on the line. > > //create sql statement > $sql = "select Business_Name,Trading_Details where Business_Type

RE: SQL statement in PHP

2001-02-16 Thread Jon Haworth
PHP sees the first " of "Consultancy" as being the end of the variable $sql. To get round this, change the " to ' inside the statement (e.g. ...where Business_Type = 'Consultancy' and...) HTH Jon -Original Message- From: Matt Davis [mailto:[EMAIL PROTECTED]] Sent: 16 February 2001 12:

Re: SQL statement in PHP

2001-02-16 Thread Siim Einfeldt aka Itpunk
Take a look at your query once again: "select/../"Consultancy"/.../" You can have "" inside "". The ways to do it, so that it would work: -> use '$somethinghere' instead of "$something" or -> use \"$somethinghere\" instead of second "$something" or -> use '".$somthingh

Re: SQL statement please help

2001-02-07 Thread Bob Hall
>Hi, > >I hope that someone can help me with a SQL statement. > >I dont know if this is the right place to ask the question, if not >please redirect me. > >I have a table in my MySQL database named "data" with the following fields > >date: UNIX Timestamp >Datasize : Int > >now i would lik