List:General Discussion« Previous MessageNext Message »
From:Dušan Pavlica Date:February 5 2007 9:21am
Subject:Re: SET @var and insert that as cunting var into table with insertselect
View as plain text  

Barry napsal(a):
> Dušan Pavlica schrieb:
>>
>>
>> Barry napsal(a):
>>> Hello Everyone!
>>>
>>> I am having a big problem with counting inserting rows.
>>>
>>> This is my Query:
>>>
>>> SELECT MAX(id) INTO @maxid FROM table1; // @maxid is now  44
>>>
>>> INSERT INTO table2 (orderid, someothervars)
>>> SELECT @maxid +1, blahvar FROM table3;
>>>
>> try
>> select @maxid:=max(id)-1 from table1;
>> insert into table2 (orderid, someothervars)
>> SELECT @maxid:=@maxid +1, blahvar FROM table3;
>>
>> dusan
> Thanks dusan, thanks filip that works perfect :)
>
> Can you tell me where i can find that " := " function on the mysql dev 
> site? Search function don't allow " := " and i didn't found it.
>
> That would be very nice :)
>
> My best regards
>     Barry
>
Barry,

it's not function, it's assignment operator. Try to search 'user-defined 
variables'  in manual. It's chapter 9.3 in version I have

Dusan
Thread
SET @var and insert that as cunting var into table with insert selectBarry2 Feb
  • Re: SET @var and insert that as cunting var into table with insertselectBarry2 Feb
  • Re: SET @var and insert that as cunting var into table with insertselectDušan Pavlica2 Feb
    • Re: SET @var and insert that as cunting var into table with insertselectBarry2 Feb
      • Re: SET @var and insert that as cunting var into table with insertselectDušan Pavlica5 Feb