显示标签为“means”的博文。显示所有博文
显示标签为“means”的博文。显示所有博文

2012年2月9日星期四

basic sql question

Hey, this is probably a pretty basic SQL question -- i'm not a SQL
genious by any means.
I have two tables, both identical for the purposes of this question.
table a
table b
table b has some records which are meant to "replace" some rows from
table a (same IDs) if they exist. basically, b overrides the rows in a
if they exist in b.
table a
- row a.1
- row a.2
- row a.3
table b
- row b.2 --> same id as a.2
therefore recordset looks like: a.1, b.2, a.3
...not sure how else to explain it.
what type of join am i looking for here?
just need a push in the right direction ...
thanksselect * from table1 as a inner join table2 as b on a.[id] = b.[id]
where b.[id] is null
union all
select * from tale2
order by [id] asc;
AMB
"rob" wrote:

> Hey, this is probably a pretty basic SQL question -- i'm not a SQL
> genious by any means.
> I have two tables, both identical for the purposes of this question.
> table a
> table b
> table b has some records which are meant to "replace" some rows from
> table a (same IDs) if they exist. basically, b overrides the rows in a
> if they exist in b.
> table a
> - row a.1
> - row a.2
> - row a.3
> table b
> - row b.2 --> same id as a.2
> therefore recordset looks like: a.1, b.2, a.3
> ...not sure how else to explain it.
> what type of join am i looking for here?
> just need a push in the right direction ...
> thanks
>|||Alejandro Mesa wrote:
> select * from table1 as a inner join table2 as b on a.[id] = b.[id]
> where b.[id] is null
> union all
> select * from tale2
> order by [id] asc;
>
> AMB
Unions! I forgot about Unions. Thanks! I'll be in touch if I continue to
have a problem.
:rob|||It sounds like you want to use a left join:
SELECT ISNULL( B.Col1, A.Col1 ) AS Col1
FROM A
LEFT JOIN B ON A.Id = B.Id
ORDER BY SomeColumn
You can do the ISNULL for every column in the tables and that will allow
you to have any entries in B override the values in the corresponding row
in A.
Hope that helps,
BC
rob <rcherny@.nospamnavarts.com> wrote in news:#sNGWg6MFHA.3788
@.tk2msftngp13.phx.gbl:

> Hey, this is probably a pretty basic SQL question -- i'm not a SQL
> genious by any means.
> I have two tables, both identical for the purposes of this question.
> table a
> table b
> table b has some records which are meant to "replace" some rows from
> table a (same IDs) if they exist. basically, b overrides the rows in a
> if they exist in b.
> table a
> - row a.1
> - row a.2
> - row a.3
> table b
> - row b.2 --> same id as a.2
> therefore recordset looks like: a.1, b.2, a.3
> ...not sure how else to explain it.
> what type of join am i looking for here?
> just need a push in the right direction ...
> thanks
>

basic RS questions

Hi,
those things I can't find out:
1. What means "Export" to "HTML with Office web components"? It looks just
like the orginal report viewer to me, ie confusing as the first export format.
2. Is it possible to re-sort a report table on "any" report column in the
report viewer or do I have to export to excel ?
3. Where do I declare "document map pane" items ? Can't find any props.
4. Can History page be hidden in the viewer when props for this report says
it can't generate History ?
5. Is it possible to stop users (in security) to do subscriptions and if so,
will those pages/buttons dissappear in the viewer ?
/Jerome KI can help with some of this... see inline
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"/jerome k" <jeromek@.discussions.microsoft.com> wrote in message
news:0C8E29BE-0140-4F67-AC3A-358FC894CA94@.microsoft.com...
> Hi,
> those things I can't find out:
> 1. What means "Export" to "HTML with Office web components"? It looks just
> like the orginal report viewer to me, ie confusing as the first export
> format.
This exports to a file that you can place on some other web site...
> 2. Is it possible to re-sort a report table on "any" report column in the
> report viewer or do I have to export to excel ?
If there are no groupings you can do this... Ihave some examples using SQL
2000 at www.msbicentral.com It is kind of a pain to do in SQL 2k , but SQL
2005 makes it easy. (If there are groupings you can still do it, but it
becomes more complicated.)
> 3. Where do I declare "document map pane" items ? Can't find any props.
right click on any Group, text box etc. and when the dialog box opens, go to
the navigation tab... use the document map box to enter the field info.
> 4. Can History page be hidden in the viewer when props for this report
> says
> it can't generate History ?
I Don't know..
> 5. Is it possible to stop users (in security) to do subscriptions and if
> so,
> will those pages/buttons dissappear in the viewer ?
Yes it is possible to NOT allow subscriptions, RS is role based security and
one of the privileges is whether or not a user can make subscriptions...
Simply create a new role (BrowserNoSuscriptions)... and add every permission
that a Browser role has except subscriptions and you will be good.
I do not know if the buttons disappear or not... You'll have to test it and
see.
> /Jerome K
>