A few Sql questions - anyone care to help!
Is there a way in vanilla 2.1
to set a Column to Autoincrement
->Column('SampleID', 'int(11)', False, 'key','auto_increment')
->Column('SampleID', 'int(11)', False, 'key', TRUE)
with item after key being autoincrement.
it doesn't seem so.
if not how does an ALTER in vanilla jargon.
Also how does one do a TRUNCATE in vanilla jargon
I'd like to fill SampleTable with entries based on whether the User Table for a specific column and row equals a certain value.
e.g. if a column in User Table is ABC It has a value of Yes or No.
if it is Yes I would like to grab the Userid and put it into TableB.
So table B columns sampleID UserID XYX
sampleid is primary key and autoincrements
UserID is grabbed from User Table (if column ABC in User Table is equal to Yes)
XYZ (just defaults to default value)
this works as a SQL command is there a vanilla syntax for insert into.
INSERT INTO TableB (
ABC = "Yes"
the problem with insert into though is it will make duplicate UserIDs if run more than once.
so ideally I'd like to join and update if it exists or insert row if it doesn't exist.
I tried this as well
update TableB b inner User u on on u.ABC = "Yes" set b.UserID = u.UserID
it doesn't seem to be correct syntax and if the record doesn't exist it doesn't insert new record.
I can probably manually get around this, but if someone has insights that would be cool.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.