Click here to Skip to main content
15,306,313 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQLite how to delete rows in a table (C++) Pin
Richard MacCutchan8-Feb-19 22:44
mveRichard MacCutchan8-Feb-19 22:44 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661310-Feb-19 21:58
professionalsteve_949661310-Feb-19 21:58 
Questionfinding periods Pin
joost.versteegen8-Feb-19 4:22
Memberjoost.versteegen8-Feb-19 4:22 
AnswerRe: finding periods Pin
joost.versteegen9-Feb-19 10:40
Memberjoost.versteegen9-Feb-19 10:40 
Questionupdate temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 3:32
Memberjoost.versteegen7-Feb-19 3:32 
AnswerRe: update temp table with results from sub query (actually it is a function) Pin
ZurdoDev7-Feb-19 4:36
professionalZurdoDev7-Feb-19 4:36 
GeneralRe: update temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 4:45
Memberjoost.versteegen7-Feb-19 4:45 
AnswerRe: update temp table with results from sub query (actually it is a function) Pin
Richard Deeming7-Feb-19 8:34
mveRichard Deeming7-Feb-19 8:34 
GeneralRe: update temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 11:20
Memberjoost.versteegen7-Feb-19 11:20 
GeneralRe: update temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 20:33
Memberjoost.versteegen7-Feb-19 20:33 
QuestionTables left and right Pin
Member 141362635-Feb-19 5:21
MemberMember 141362635-Feb-19 5:21 
AnswerRe: Tables left and right Pin
Richard MacCutchan5-Feb-19 6:10
mveRichard MacCutchan5-Feb-19 6:10 
AnswerRe: Tables left and right Pin
ZurdoDev7-Feb-19 4:41
professionalZurdoDev7-Feb-19 4:41 
QuestionUsing JSON functions with Always Encrypted data in SSMS Pin
Hypermommy4-Feb-19 6:06
MemberHypermommy4-Feb-19 6:06 
AnswerRe: Using JSON functions with Always Encrypted data in SSMS Pin
Richard Deeming4-Feb-19 9:20
mveRichard Deeming4-Feb-19 9:20 
GeneralRe: Using JSON functions with Always Encrypted data in SSMS Pin
Hypermommy6-Feb-19 2:38
MemberHypermommy6-Feb-19 2:38 
Questiondatabase Pin
Member 141284154-Feb-19 6:03
MemberMember 141284154-Feb-19 6:03 
AnswerRe: database Pin
Jörgen Andersson4-Feb-19 8:41
professionalJörgen Andersson4-Feb-19 8:41 
QuestionHaving difficulty to replicate entries in SQL query result Pin
paul4everyone28-Jan-19 2:37
Memberpaul4everyone28-Jan-19 2:37 
Good day all!
Please assist if you can in resolving this my SQL query difficulty.
I have 2 query results as follows;


Table A
CID | NAME | CREDENTIAL | BAL | GID1 | GID2 | UNIQUE_ID
01 | AAA | debtor | 20 | 03 | 02 | 01-03,02
02 | BBB | debtor | 15 | 01 | 05 | 02-01,05
03 | CCC | debtor | 10 | 02 | 04 | 03-02,04

TABLE B
CID | NAME | BAL
01 | AAA | 20
02 | BBB | 15
03 | CCC | 10
04 | DDD | 5
05 | EEE | 2
06 | FFF | 4

Now I need help in getting TABLE C that should look like this;

CID | NAME | CREDENTIAL | BAL | UNIQUE_ID
01 | AAA | debtor | 20 | 01-03,02
03 | CCC | guarantor | 10 | 01-03,02
02 | BBB | guarantor | 15 | 01-03,02

02 | BBB | debtor | 15 | 02-01,05
01 | AAA | guarantor | 20 | 02-01,05
05 | EEE | guarantor | 2 | 02-01,05

03 | CCC | debtor | 10 | 03-02,04
02 | BBB | guarantor | 15 | 03-02,04
04 | DDD | guarantor | 5 | 03-02,04

WHAT I INTEND TO ACHIEVE
This is like a loan collection summary.
CID = General Primary Key for every customer
NAME = Customer names
CREDENTIAL = To help me diffentiate between the loan collector and the guarantors, so that I can group in my front end VB application.
BAL = everyone account balance
GID = guarantor for the loan collector, GID is a subset of CID
UNIQUE_ID = A string to combine the CID and the GID for a loan transaction so that I can easily isolate everything about a single loan transaction.

Table A is an abridged form of each loan collection transaction.
Table B carries the account balance for every customer.
Now, I expect Table C to carry all loan record in Table A and use the entries in GID1 and GID2 columns to fetch their corresponding details from Table B while retaining the Unique_ID entries from Table A so that sorting by Unique_ID will bring all loans together.

Please assist me with a way to achieve this, I have been thinking for days, yet no breakthrough.
Thanks in advance

modified 28-Jan-19 21:07pm.

AnswerRe: Having difficulty to replicate entries in SQL query result Pin
Richard MacCutchan28-Jan-19 2:56
mveRichard MacCutchan28-Jan-19 2:56 
GeneralRe: Having difficulty to replicate entries in SQL query result Pin
paul4everyone28-Jan-19 4:20
Memberpaul4everyone28-Jan-19 4:20 
SuggestionRe: Having difficulty to replicate entries in SQL query result Pin
ZurdoDev28-Jan-19 4:48
professionalZurdoDev28-Jan-19 4:48 
GeneralRe: Having difficulty to replicate entries in SQL query result Pin
paul4everyone28-Jan-19 6:54
Memberpaul4everyone28-Jan-19 6:54 
GeneralRe: Having difficulty to replicate entries in SQL query result Pin
Richard MacCutchan28-Jan-19 6:01
mveRichard MacCutchan28-Jan-19 6:01 
GeneralRe: Having difficulty to replicate entries in SQL query result Pin
paul4everyone28-Jan-19 6:51
Memberpaul4everyone28-Jan-19 6:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.