Re: Wierd INSERT ... SELECT syntax problem

2008-09-06 Thread Dan Tappin
Thanks for the tip. I am looking at just making 16 separate queries. It will be easier to manage and faster to run. Dan On Sep 6, 2008, at 9:37 PM, Brent Baisley <[EMAIL PROTECTED]> wrote: Well, for your simple example, you can use query variables to add the "counters". SET @cntr:=0, @last

Re: Wierd INSERT ... SELECT syntax problem

2008-09-06 Thread Brent Baisley
Well, for your simple example, you can use query variables to add the "counters". SET @cntr:=0, @lastVal:='A' INSERT INTO tableB LOC,DATA SELECT CONCAT(LOC, CONCAT( IF(@lastVal=LOC, @cntr:[EMAIL PROTECTED], @cntr:=0), IF(@lastVal:=LOC,'',''))) LOC, CONCAT(DATA, @cntr) FROM tableA ORDER BY

Wierd INSERT ... SELECT syntax problem

2008-09-05 Thread Dan Tappin
I have an existing data set - here is an example (the real one is more complex than this) LOC DATA - A 1 B 2 C 3 D 4 E 5 F 6 ... and I am looking to run some sort of INSERT ... SELECT on this to make a new table like this: LOC DATA

RE: Advanced SELECT Syntax Help Needed!

2004-11-06 Thread Monique
anced SELECT Syntax Help Needed! On Fri, 5 Nov 2004 17:49:29 -0500, Rhino <[EMAIL PROTECTED]> wrote: > I'm not sure why you want to use a subquery; if MySQL is anything like DB2, > a join usually performs better than a subquery and the optimizer converts a > subquery to

Re: Advanced SELECT Syntax Help Needed!

2004-11-06 Thread Frederic Wenzel
On Fri, 5 Nov 2004 17:49:29 -0500, Rhino <[EMAIL PROTECTED]> wrote: > I'm not sure why you want to use a subquery; if MySQL is anything like DB2, > a join usually performs better than a subquery and the optimizer converts a > subquery to a join ("under the covers") whenever it can anyway. Therefore

Re: Advanced SELECT Syntax Help Needed!

2004-11-05 Thread Rhino
linkname2 from main m right outer join links1 l1 on m.id = l1.id right outer join links l2 on m.id = l2.id; I haven't tested it but it ought to work. Rhino - Original Message - From: "Monique" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November

Advanced SELECT Syntax Help Needed!

2004-11-05 Thread Monique
Hi! I would love some help with my syntax (or another strategy). I keep bombing. I've simplified it. Here is the deal: Three files: Main: id, name Links1: id, linkname1 (a record may or may not exist for each record in Main) Links2: id, linkname2 (a record may or may not exist for each re

Re: different select syntax in 4.0.xx?

2003-09-08 Thread Sergei Golubchik
Hi! On Sep 07, Sebastian Hoffmann wrote: > Hello, > > I have just updated from MySQL 3.23 to MySQL 4.0.14. My operating > system is Mac OS X (10.2.6). > > I have now encountered an odd problem with some "select" statements > which appear to work differently in the new version: > > I want to d

Re: different select syntax in 4.0.xx?

2003-09-08 Thread Victoria Reznichenko
Sebastian Hoffmann <[EMAIL PROTECTED]> wrote: > > I have just updated from MySQL 3.23 to MySQL 4.0.14. My operating > system is Mac OS X (10.2.6). > > I have now encountered an odd problem with some "select" statements > which appear to work differently in the new version: > > I want to do a j

different select syntax in 4.0.xx?

2003-09-07 Thread Sebastian Hoffmann
Hello, I have just updated from MySQL 3.23 to MySQL 4.0.14. My operating system is Mac OS X (10.2.6). I have now encountered an odd problem with some "select" statements which appear to work differently in the new version: I want to do a join on two tables which are in two different databases

Update Select Syntax

2003-07-04 Thread Chris Fowler
Hello All, What syntax for MySQL should I be looking at to solve a problem like the following: 3 Tables (oversimplified to show the problem area) individual.id individual.name individual_addresses.individual_id individual_addresses.address_id address.id address.street Although the structure is

Re: Help - select syntax if else

2003-01-08 Thread Keith C. Ivey
On 8 Jan 2003, at 15:27, Svens Klave wrote: > | image | check | > | 6782 | 0 | > | 2732 | 1 | > | 6734 | 1 | > > so I want to make query > select * from foo1 where [so is it possible to make some if check=1 then > image is image but if check=0 then into image goes othe

Re: Help - select syntax if else

2003-01-08 Thread Zak Greant
On Wed, Jan 08, 2003 at 03:27:51PM +0200, Svens Klave wrote: > > Can anybody help me > with select query > > how to do this: > > I have table "foo1" with two fields "image" "check" > > | image | check | > | 6782 | 0 | > | 2732 | 1 | > | 6734 | 1 | > > so I want to ma

Re: Help - select syntax if else

2003-01-08 Thread Roger Baklund
* Svens Klave > Can anybody help me > with select query I can try. > how to do this: > > I have table "foo1" with two fields "image" "check" > > | image | check | > | 6782 | 0 | > | 2732 | 1 | > | 6734 | 1 | > > so I want to make query > select * from foo1 where [so is

Re: Help - select syntax if else

2003-01-08 Thread Brent Baisley
You don't even need the "check" field you can just directly check the contents of the image field. Although I'm not sure if you are trying to set a filter or display something different. If you want to display a conditional on a field then you need to specify that field directly. select *,if(im

Help - select syntax if else

2003-01-08 Thread Svens Klave
Can anybody help me with select query how to do this: I have table "foo1" with two fields "image" "check" | image | check | | 6782 | 0 | | 2732 | 1 | | 6734 | 1 | so I want to make query select * from foo1 where [so is it possible to make some if check=1 then image

Re: create table with select syntax error problem

2001-05-17 Thread Mark Rowlands
- > From: "Mark Rowlands" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, May 17, 2001 3:11 > Subject: create table with select syntax error problem > > > CREATE TABLE Ftt (sajtid smallint(6) DEFAULT '0' NOT NULL,count int(10) &

Re: create table with select syntax error problem

2001-05-16 Thread Rolf Hopkins
Original Message - From: "Mark Rowlands" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 17, 2001 3:11 Subject: create table with select syntax error problem > CREATE TABLE Ftt (sajtid smallint(6) DEFAULT '0' NOT NULL,count int(

create table with select syntax error problem

2001-05-16 Thread Mark Rowlands
CREATE TABLE Ftt (sajtid smallint(6) DEFAULT '0' NOT NULL,count int(10) unsigned DEFAULT '0' NOT NULL,PRIMARY KEY (sajtid)) select log.sajtid,count(*) from log,sajter where log.sajtid=sajter.id and log.mon = 5 group by log.sajtid; the create table on its own works, the select statement works,

Bad Select Syntax workaround?

2001-04-08 Thread phobo
I have a (dumb!) program that performs SELECT statements with a quote around the table and the fieldname; see the portion from the trace log below: Cardfivefffe35e1:fffed875 EXIT SQLExecDirect with return code -1 (SQL_ERROR) HSTMT 0x00cf17ac UCHAR * 0x00ae6

Re: REPOST: SELECT syntax

2001-04-05 Thread Ashley M. Kirchner
"Thalis A. Kalfigopoulos" wrote: > Check you don't have empty strings as empty remarks, but that you have NULLs. > Even with empty strings as remarks though you can bypass them with an extra WHERE >condition :-) That was it. I was storing empty strings, instead of NULLs. Thanks! AMK4

Re: REPOST: SELECT syntax

2001-04-05 Thread Thalis A. Kalfigopoulos
On Thu, 5 Apr 2001, Ashley M. Kirchner wrote: > "Thalis A. Kalfigopoulos" wrote: > > > > +--++--+-+ > > > | task | comment |remarks | history | > > > +--++--+-+ > > > | task_1 | cmt_1

Re: REPOST: SELECT syntax

2001-04-05 Thread Ashley M. Kirchner
"Thalis A. Kalfigopoulos" wrote: > > +--++--+-+ > > | task | comment |remarks | history | > > +--++--+-+ > > | task_1 | cmt_1| rmk_1| | > > | task_1 | cmt_2

Re: REPOST: SELECT syntax

2001-04-05 Thread Thalis A. Kalfigopoulos
On Wed, 4 Apr 2001, Ashley M. Kirchner wrote: > > Db -> table1, table2 and table3 > > SELECT table1.task, table2.comment, table2.remarks, table3.history > FROM table1 LEFT JOIN table2 ON table1.id=table2.todoid > LEFT JOIN table3 ON table1.id=table3.todoid WHERE table1.id=10; > > Resul

REPOST: SELECT syntax

2001-04-04 Thread Ashley M. Kirchner
Db -> table1, table2 and table3 SELECT table1.task, table2.comment, table2.remarks, table3.history FROM table1 LEFT JOIN table2 ON table1.id=table2.todoid LEFT JOIN table3 ON table1.id=table3.todoid WHERE table1.id=10; Results (roughly) in: +--++--+-

SELECT syntax

2001-04-03 Thread Ashley M. Kirchner
Db -> table1, table2 and table3 SELECT table1.task, table2.comment, table2.remarks, table3.history FROM table1 LEFT JOIN table2 ON table1.id=table2.todoid LEFT JOIN table3 ON table1.id=table3.todoid WHERE table1.id=10; Results (roughly) in: +--++--+-