VAUXHALL ASTRA GTE MK1 CAR PERFORMANCE SPORTS TURBO
www.mk1oc.com
Google
AlbumAlbum  CalendarCalendar  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 MapMap  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
MK1OC Club
Shop Contact MK1OC by Email

:: best viewed @ 1024 x 768 :.

Calendar 
Anyone good at SQL...??

 
Post new topic   Reply to topic    MK1 Astra Owners Club Forum Index -> Non-Astra Related
View previous topic :: View next topic  
Author Message
Jason
Rallyslag
<font color=#FF8000>Rallyslag</font>


Joined: 29 May 2005
Posts: 5552
Location: Halifax on't couch or in't pub

PostPosted: Mon Nov 28, 2005 9:24 pm    Post subject: Anyone good at SQL...?? Reply with quote

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
View user's profile Send private message View user's gallery Visit poster's website
SirNick
Astra Enthusiast
Astra Enthusiast


Joined: 29 May 2005
Posts: 338
Location: Stonehouse, Gloucestershire.

PostPosted: Tue Nov 29, 2005 12:19 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail View user's gallery
Crafty
Astra Craftsman
Astra Craftsman


Joined: 18 Oct 2005
Posts: 56

PostPosted: Tue Nov 29, 2005 9:02 pm    Post subject: Reply with quote

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
View user's profile Send private message View user's gallery
Jason
Rallyslag
<font color=#FF8000>Rallyslag</font>


Joined: 29 May 2005
Posts: 5552
Location: Halifax on't couch or in't pub

PostPosted: Tue Nov 29, 2005 9:52 pm    Post subject: Reply with quote

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...laughing

Oh and SirNick, the experts exchange thingy is quite a lot of money to join now, you could however, give me your sign on wink 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
View user's profile Send private message View user's gallery Visit poster's website
SirNick
Astra Enthusiast
Astra Enthusiast


Joined: 29 May 2005
Posts: 338
Location: Stonehouse, Gloucestershire.

PostPosted: Thu Dec 01, 2005 12:10 pm    Post subject: Reply with quote

Jason

Another very good site which is free to join is

http://www.carobit.com/


Nick

_________________
Back to top
View user's profile Send private message Send e-mail View user's gallery
Chunk
Astra Old Hand
Astra Old Hand


Joined: 30 May 2005
Posts: 865
Location: Cheltenham

PostPosted: Thu Dec 01, 2005 7:07 pm    Post subject: Reply with quote

quarter past ten o clock
Back to top
View user's profile Send private message View user's gallery
Jason
Rallyslag
<font color=#FF8000>Rallyslag</font>


Joined: 29 May 2005
Posts: 5552
Location: Halifax on't couch or in't pub

PostPosted: Thu Dec 01, 2005 8:00 pm    Post subject: Reply with quote

laughing laughing
_________________
The most hip hop mofo to ever come out of Halifax.....Jam Master Jay in d house!!!
Back to top
View user's profile Send private message View user's gallery Visit poster's website
Crafty
Astra Craftsman
Astra Craftsman


Joined: 18 Oct 2005
Posts: 56

PostPosted: Sat Dec 03, 2005 8:37 am    Post subject: Reply with quote

www.sqlservercentral.com

is good too.
Back to top
View user's profile Send private message View user's gallery
Display posts from previous:   
Post new topic   Reply to topic    MK1 Astra Owners Club Forum Index -> Non-Astra Related All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum