|
-
May 29th, 2010, 05:59 AM
#1
[RESOLVED] selective rows between two tables
Hi all
i have a little problem and i want to see if i can address it from sql instead using CODE
i have two tables, the first one is the base table, its structure is something like this:
values:
Code:
1, 'some text',int value(5),int value(112)
the second table contains copies of some records from the first table
structure:
Code:
id,col1,col2,col3,row_id
values
Code:
10,'some other text',int value(5),int value(112),1
the columns "row_id" in table 2 stores the pk id of table 1
that's mean that table 2 contains a copy of the row with the id of 1 from table 1 but with different text value.
what i want to achieve is that with a single select i'll get all rows from table 1 but if there is a copy of any row in table 2 it will replace the original row from table 1 in the select result.
is there any way to do it with pure sql or should i filter them only after i get the result from the two tables ? (i'm trying to save the two select statements)
Thanks and best regards!
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|