Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 10-10-2006, 11:29 PM Need SQL Help
Novice Talker

Posts: 7
Trades: 0
I have following tables
Temp1

ID Client Drug
3889----- aa ----- A
4998 ----cc ------ A
4998 ----dd ----- B
8011---- ff ---- C
8011 ----gg ---- A

and Temp2
ID -- Client --- Drug
8011-------- ff ----- C
8011 -------gg ------- A

I have a conditional loop which changes the values of these 2 tables. I populate temp2 by getting all the similar ids from temp1. e.g: first time 3889 then 4998 then 8011.
my task is, all the ids in temp2 where temp2.id<>temp1.id should have same client and drug. if 8011 has client bb and drug B then 4998,3889 should also have client bb and drug B in them.
if 4998 has client dd and drug B then 8011, 3889 should also have client dd and drug B and so on. means all the records in temp1 should contain similar clients and drugs in them in actual table. I'll need to add the missing client and drug for the ID where its misiing in actual table.
After this process my actual drug table will look like:

ID ----- Client ----- Drug
3889 --- dd ----- B
3889 ----- cc ---- A
3889 --- aa ---- A
3889 ---- ff ---- ---- C
3889 ------ gg ------ A
4998 ---- dd ---- B
4998 ---- cc ----- A
4998 ---- aa ------ A
4998-------- ff -------- C
4998 ------ gg ------ A
8011 --- dd ---- B
8011 ----- cc -- A
8011 ---- aa ---- A
8011 ------- ff ------- C
8011--------gg ------- A

How can I achive this goal. Please help...
neha101 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-11-2006, 09:32 PM Re: Need SQL Help
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
He's not making a service request. Don't spam the board like that.

Having said that, coldgansta is right to a small extent. The answer to your question depends on both your database and your programming language used, and different people will be able to answer it based on their knowledge.

What I would do personally (and this is using Access) is create the first row, copy/paste it 4 times and change the client and drug values as appropriate, and then copy and paste those 5 rows twice, changing the ID value on each subsequent set of 5 rows.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to Need SQL Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25808 seconds with 12 queries