|asianCoolz||can mysql do this ---- > insert into tableX select field1='abc', field2, field3 from tableX where field1='xxx' ?|
can mysql do insert and select in one statement?
insert into b (blue, green) SELECT red, alpha from a WHERE red=1;
|asianCoolz||sqs, it's different. u see my statement, i wat the field1 be assigned with new value|
insert into tableX select field1='abc', field2, field3 from tableX where field1='xxx' ?
it's actually copy and insert into same table
and field1 is assigned new value while doing insert
insert into tableX(field1,field2,field3) SELECT 'abc', field2, field3 from tableX where field1='xxx'
field1 will ALWAYS be 'abc' in the new row?
is that what you want?
|asianCoolz||genius . thanks dude !|
|Zombie||SELECT `CUSTOMER` . `REP_NUM` , SUM( `CUSTOMER` . `BALANCE` ) FROM CUSTOMER WHERE `REP_NUM`="65" AND `BALANCE`>|
`CREDIT_LIMIT` GROUP BY `CUSTOMER` . `REP_NUM` ORDER BY `CUSTOMER`.`REP_NUM`
This is returning a Null Set.
And it shouldn;t be
It works up to the point where I try and exclude those "Balances" greater than Credit Limit.
|CareBear\||Zombie : Is credit_limit negative?|
|CareBear\||Zombie : Ie. the lower limit for the balance?|
Zombie : Then you'll have to negate it.
Since credit is negative balance.
|Zombie||But its nmot a negative|
credit_limit is the maximum negative value that balance is allowed to have?
(Or minimum, to be strictly correct.)
|chadmaynard||maximum in magnitude|
|Zombie||Both values are positive.|
|CareBear\||Zombie : What does credit_limit represent? What meaning does it have?|
|Zombie||A credit limit of a CUST_NUM by a specific REP_NUM|
The specific REP_NUM is
customers represented by sales rep #65 that have balances less then their credit limit
|CareBear\||You didn't answer my question though.|