View previous topic :: View next topic |
Author |
Message |
Jason Rallyslag
Joined: 29 May 2005 Posts: 5552
Location: Halifax on't couch or in't pub
|
Posted: Mon Nov 28, 2005 9:24 pm Post subject: Anyone good at SQL...?? |
|
|
I am getting seriously peed off with this 'should be simple, but isn't' question...
I have FieldA and FieldB, I want to output to fieldC in a table.
ie. I want to run some type of SQL statement that will save me from having to go through each record in a mahooosive database...
I have JAN in FieldA and 05 in FieldB I want to populate FieldC with JAN05
It should be easy, believe me I have tried all sorts.
I have tried a simple INSERT INTO STATEMENT, I have tried all kinds of configurations of this, I have tried the UNION route and also in my desperation I have tried an Append query, which would never work anyhow, I just can't get it to play ball.
I would appreciate it if any of you computer bods could help out. _________________ The most hip hop mofo to ever come out of Halifax.....Jam Master Jay in d house!!! |
|
Back to top |
|
|
SirNick Astra Enthusiast
Joined: 29 May 2005 Posts: 338
Location: Stonehouse, Gloucestershire.
|
Posted: Tue Nov 29, 2005 12:19 pm Post subject: |
|
|
Hi
I studied SQL years ago and can't remember a thing, like everything I suppose, if you don't do it often then you forget. I found this link and thought that it could be similar to what you want, however it could be completely useless.
http://lists.evolt.org/archive/Week-of-Mon-20030127/133424.html
I am a member at experts-exchange and usually find that if I have an IT problem then someone there can put you right. Its free to join, or at least I think it is because it was when I joined back in the late 1990s. When you join they give you points, you then go to the right catergory in your case SQL. You then tell them your problem and offer say 100 points for the right answer. I bet someone will tell you what you want within the hour. Its a great site.
www.experts-exchange.com _________________
|
|
Back to top |
|
|
Crafty Astra Craftsman
Joined: 18 Oct 2005 Posts: 56
|
Posted: Tue Nov 29, 2005 9:02 pm Post subject: |
|
|
are we talking MSSQL here ?
if FieldC is in a different table to FieldA and B then:
insert into RESULT_TABLE ( FieldC )
select FieldA + FieldB from SOURCE_TABLE
if all fields are in the same table then just:
update SOURCE_TABLE set FieldC = FieldA + FieldB
If all fields are not char/varchar type then use the CONVERT function to shift them to whatever you need...
Why are you not sotring dates in datetime/smalldatetime fields ?
if its not MSSQL the above should still work in most cases, unless its oracle, then you probably need to hire a consultant for 6 weeks at god knows how much per hour.... |
|
Back to top |
|
|
Jason Rallyslag
Joined: 29 May 2005 Posts: 5552
Location: Halifax on't couch or in't pub
|
Posted: Tue Nov 29, 2005 9:52 pm Post subject: |
|
|
Cheers for that, you were on the button Crafty mi old china...
I had already sorted the problem out thanks to our very own SQL guru Glen via MSN.
I am just getting to grips with all this programming stuff again, it's amazing how stale your brain can go when skills are not used enough. Well it could be something to do with age but I'll go with the first thought...
Oh and SirNick, the experts exchange thingy is quite a lot of money to join now, you could however, give me your sign on that'd make it a lot cheaper...!!! _________________ The most hip hop mofo to ever come out of Halifax.....Jam Master Jay in d house!!! |
|
Back to top |
|
|
SirNick Astra Enthusiast
Joined: 29 May 2005 Posts: 338
Location: Stonehouse, Gloucestershire.
|
Posted: Thu Dec 01, 2005 12:10 pm Post subject: |
|
|
Jason
Another very good site which is free to join is
http://www.carobit.com/
Nick _________________
|
|
Back to top |
|
|
Chunk Astra Old Hand
Joined: 30 May 2005 Posts: 865
Location: Cheltenham
|
Posted: Thu Dec 01, 2005 7:07 pm Post subject: |
|
|
quarter past ten o clock |
|
Back to top |
|
|
Jason Rallyslag
Joined: 29 May 2005 Posts: 5552
Location: Halifax on't couch or in't pub
|
Posted: Thu Dec 01, 2005 8:00 pm Post subject: |
|
|
_________________ The most hip hop mofo to ever come out of Halifax.....Jam Master Jay in d house!!! |
|
Back to top |
|
|
Crafty Astra Craftsman
Joined: 18 Oct 2005 Posts: 56
|
|
Back to top |
|
|
|