Merging Rows

Jul 15, 2007

it doesn't appear possible to merge cells by col in RS 2005 ? am i missing some more advanced feature or is it a great big over sight on MS's part?



i basicly want a 3 column table, with the rows in the first column merged and the text turned on it's side showing bottom to top.



pretty ordinary kind of thing to do i would have thought

View 9 Replies


ADVERTISEMENT

Merging Rows

Jun 28, 2006

Say I have a table with the columns (and example data):

CustomerNo, ContactNo, ActivityNo
null, null, 1
100, null, 1
null, 666, 1
null, null, 2
200, null, 2
null, 777, 2

From this I would like to get the result:

CustomerNo, ContactNo, ActivityNo
100, 666, 1
200, 777, 2

How do I solve this. Im getting grey hair here...

View 5 Replies View Related

Merging Like Rows

Jan 20, 2008

Hi All,

I have a query that I'm working on, but instead of giving the query, I wanted to ask a basic syntax question. If more info is needed, let me know. If you have 2 rows that have a common relationship, but differing information in some fields, can you merge them all onto one row? I've done this with Sum(case) expressions, but I don't want to 'add' anything. In the following example, the ActivityID refers to a break. ActivityID can be:

0=Pick up
1=Drop Off
2=Lunch
3=Break

So if I wanted to see 2 breaks on 1 row in the following example, would this be possible:



Veh ActID ArrTime DepTime
1 3 7:00 8:00
1 3 10:00 11:00



Veh ActID ArrTime DepTime ArrTime DepTime
1 3 7:00 8:00 10:00 11:00


Thanks in advance for your help!

Craig

View 4 Replies View Related

SQL Merging Rows

Oct 20, 2006

Hello everyone!

Maybe you can help me out:

I have 2 tables (A and B), Table A has 2 fields t1 and t2...each of them has a number that is related to the primary key of Table B.

What i want is to make a query that presents:

t1,t2, B.descriptionof_t1, B.description_t2

Anyone that can help me?



Thanks in advance...

View 5 Replies View Related

Merging Rows

Mar 6, 2008

Hi all,

I'm facing the following problem:

TextData ObjectID SPID StartTime EndTime
------------------------------------------------------------------------------------------------------------
Select 1 111111111 52 2008-03-06 11:19:51.250 NULL
Select 1 111111111 52 NULL 2008-03-06 11:19:51.250


I want to achive this result by either an update statement or a select query:

TextData ObjectID SPID StartTime EndTime
------------------------------------------------------------------------------------------------------------
Select 1 111111111 52 2008-03-06 11:19:51.250 2008-03-06 11:19:51.250

Is this possible? There is no primary key
Thanks!
Rgds,
Worf

View 5 Replies View Related

Merging Two Rows Into A Single One

Mar 5, 2012

I'm using a shipping program called endicia professional that allows for database manipulation to make my processing easier. I've managed to fix the database here and there but have had an issue combining orders from a single customer when theybuy more than one item. Ideally I would like to have it combine rows when a customer purchases items going to the same address. To avoid having an issue where the address line is the same ie two people live in the same appt complex and it combines these I thought we could use qualifiers as the purchase will have name, order Id that should be unique enough

Order-id name address sku
1234 John 46 easy ln. A27
1234 John 46 easy ln. B32

Results:
Order-id name address sku
1234 John 46 easy ln. A27,b32

View 6 Replies View Related

Merging Rows In A View

Apr 29, 2004

Hi Im having trouble with this it seems simple enough but its not!

I have a source Table called Access_table example

Name Role1 Role2 Role3 Role4 Role5
a 1 0 0 0 0
a 0 0 1 0 0
b 1 0 0 0 0
c 0 1 0 0 0
d 0 0 0 0 1
e 0 0 1 0 0
e 0 1 0 0 0
f 1 0 0 0 0
g 0 0 1 0 0

I need to create a view that basically finds all the names with double Roles and merge the results into 1 row example.
Name Role1 Role2 Role3 Role4 Role5
a 1 0 1 0 0
e 0 1 1 0 0

I cannot change the information in the source table and the results need to be in a view as the roles will change. Every time I try and do this I duplicate the row again. Can anybody suggest a solution.

Thanks in advance.

View 2 Replies View Related

Merging Duplicate Rows

Jul 23, 2005

Hello All,I have an issue with dupliate Contact data. Here it is:I have a Contacts table;CREATE TABLE CONTACTS(SSN int,fname varchar(40),lname varchar(40),address varchar(40),city varchar(40),state varchar(2),zip int)Here is some sample data:SSN: 1112223333FNAME: FRANKLNAME: WHALEYADDRESS: NULLCITY: NULLSTATE NYZIP 10033SSN: 1112223333FNAME: NULLLNAME: WHALEYADDRESS: 100 MADISON AVECITY: NEW YORKSTATE NYZIP NULLHow do I merge the 2 rows to create one row as follows:via SQL or T-SQLSSN: 1112223333FNAME: FRANKLNAME: WHALEYADDRESS: 100 MADISON AVECITY: NEW YORKSTATE NYZIP 10033Pointers appreciated.Thanks

View 5 Replies View Related

Merging Rows Within Same Table

Jul 20, 2005

I need to populate a table from several sources of raw data. For agiven security (stock) it is possible to only receive PARTS ofinformation from each of the different sources. It is also possibleto have conflicting data.I am looking to make a composite picture of a given security using thefollowing rules:1) The goal is to replace all NULL and Blank values with data2) Order of precedence (from highest to lowest) is Non-NULL Non-Blank--> Blank --> NULL3) In the case of Non-NULL Non-Blank values that conflict (aredifferent) leave existing value (even if NULL or Blank)For example:Given the following rows:Symbol Identity IdSource Exchange Type SubType Name-------- ------------ --------- --------- ------- ---------------------------TZA 901145102 CUSIP XNYS Stock NULL TV AZTECATZA 901145102 NULL NULL NULL NULLWSM 969904101 CUSIP XNYS Stock NULL WILLIAMSSONOMAWSM 969904101 NULL XNYS Stock NULLWILLIAMS-SONOMAWSM CUSIP XNYS Stock Common NULLWSM NULL CUSIP XASE Stock NULL WILLIAMSSONOMATYC 902124106 CUSIP XNYS Stock NULL TYCOTYC 902124106 CUSIP XNYS Stock NULL TYCOINTERNATIONALI am looking for the following results ('*' indicates changed value)Symbol Identity IdSource Exchange Type SubType Name-------- ------------ --------- --------- ------- ---------------------------TZA 901145102 CUSIP XNYS Stock NULL TV AZTECATZA 901145102 *CUSIP *XNYS *Stock NULL *TV AZTECAWSM 969904101 CUSIP XNYS Stock *Common WILLIAMSSONOMAWSM 969904101 *CUSIP XNYS Stock *CommonWILLIAMS-SONOMAWSM *969904101 CUSIP NULL Stock Common NULLWSM *969904101 CUSIP XASE Stock *Common WILLIAMSSONOMATYC 902124106 CUSIP XNYS Stock NULL TYCOTYC 902124106 CUSIP XNYS Stock NULL TYCOINTERNATIONAL

View 6 Replies View Related

Merging Multiple Rows From Joins

Dec 15, 2014

I am still fairly new to SQL, having been tasked with creating a csv file from data now someone else has left.

I can do the csv export using sqlcmd and I have the query sorted and am pulling out the right data, but it generates two rows, as one of the tables has multiple records per cardholder. See the query below, I know there is a way of doing it with XML PATH, I think, but it has got me slightly confused.

set nocount on

selectdbo.card.EncodedNumber,
dbo.card.IsEnabled,
dbo.Cardholder.FirstName,
dbo.cardholder.LastName,
dbo.card.ExpiryTime,
dbo.PersonalDataString.Value

[Code] .....

View 2 Replies View Related

Transact SQL :: Merging Every 3 Rows Into A Single Row

Aug 18, 2015

I have 2 columns (ID, Msg_text) in a table where i need to combine every 3 rows into single row. What would be the best option i have? I know by using 'STUFF' and 'XML PATH' i can convert all the rows into a single row but here i'm looking for every 3 rows into a single row.

View 3 Replies View Related

Merging Rows And Keeping Unique Values

Jan 14, 2015

I have this query and it works except for I am getting duplicate primary keys with unique column value. I want to combine them so that I have one primary key, but keep all the columns. Example:

Key column 1 column 2 column 3 column 4
A 1 1
A 2 2
B 2 3
B 5 5

it should look like:

A 1 1 2 2
B 2 3 5 5

Here is my query:

SELECT *
FROM [TLC Inventory].dbo.['2014 new$']
WHERE [TLC Inventory].dbo.['2014 new$'].mis_key LIKE '2%'
AND dbo_Product_Info#description NOT LIKE 'NR%'
AND dbo_Line_Info#description NOT LIKE 'OBSOLETE%'

Do I use a sum function?

View 7 Replies View Related

Data Access :: Merging Two Rows In Two Columns

Jul 8, 2015

I have a table data as shown below.

IDFNLN
1x
1y
2a
2b
3g
4t

I want output as shown below.
  
IDFNLN
1xy
2ab
3g
4t

I want the two duplicate rows to be merged into one. How to achieve it.

View 10 Replies View Related

SQL Server 2012 :: Merging Two Large Tables (More Than 100m Rows)

Aug 18, 2014

SQL 2012

I have a source table in the staging database stg.fact and it needs to be merged into the warehouse table whs.Fact.

stg.fact is not a delta feed it is basically an intra-day refresh.

Both tables have a last updated date so its easy to see which have changed.

It will be new (insert) or changed (update) data that I am interested in, there are no deletions.

As this could be in the millions of rows that are inserts or updates then this needs to be efficient.

I expect whs.Fact to go to >150 million rows.

When I have done this before I started with T-SQL Merge statement and that was not performant once I got to this size.

My original option was to do this is SSIS with a lookup task that marks the inserts and updates and deal with them seperately. However I set up the lookup tranformation the reference data set will have a package variable in the SQL commnd. This does not seem possible with the lookup in 2012! Currently looking at Merge Join transformation and any clever basic T-SQL that could work as this will need to be fast, and thats where I think that T-SQL may be the better route.

Both tables will have >100,000,000 rows
Both tables have the last updated date
The Tables are in different databases but on the same SQL Instance
Each table holds 5 integer columns, one Varchar, one datatime

Last time I used Merge it was a wider table with lots of columns so don't know if this would be an option.

View 6 Replies View Related

Merging Db

Apr 19, 2007

hello
im working on a project with a friend and store source files in a subversion server. since we are both working on the same DB everytime one of us makes a change we discover a problem in merging our changes.

is there any tool that can help in merging and making diff??
is there any alternativa?

View 1 Replies View Related

Merging Two SQL Tables

Sep 14, 2006

I have two SQL tables with the following structureInstructor tableINIDINNameINEmailInstructor PhotoIPIDINIDIPPhotoNow my new Instructor table got a new fieldINIDINNameINEmailINPhotoQuestion, how can I merge the Instructor Photo table IPPHoto field into Instructor table INPhoto field? Thank you. 

View 3 Replies View Related

Merging Database Log

Feb 3, 2008

 I wonder about the possibility of merging two identical databases on two different servers upon recovering from connection failure between them, using triggers. In order to create a simple synchronization

View 1 Replies View Related

Please Help In Merging Database.

Apr 8, 2008

I have a website wih about 50000 pageviews permonth. I am using multiple access database for each section. for example for photogallery there is a separate database, for jokes there is another one. Now I am thinking to convert my all access databases into MSSQL Server2005 databases.There are about 5 access databases  I want to merge them and convert them into 1 MDF file.How to do this?I am very new to SQL Server. Please Help I update access databases in MS ACCESS and upload them in server.When I will use SQL Server Databases How will I update them? From VS2008? Any other method? Or Should I think about creating WebBased control panel for my website like CP present in every CMS(joomla, dotnetnuke etc)? ....................................................................................................................... I have VS2008 and SQL Server 2005 Express. 

View 6 Replies View Related

Table Merging

Oct 18, 2004

I have two tables each with a date field. I have to combine these two tables and sort on the date. I want the date from each table to be on the same column though, not in seperate columns.


Ex:
Table A

ID
Log_Time
ETI

Table B
ID
Log_Time
Action
Description


Thanks for the help

Rock *

View 3 Replies View Related

Merging 2 Different SQL Server DB Into One

May 15, 2006

I have two sql server databases...one holds nothing but personalisation information. The other holds various other types of data. I would like to merge these two DBs into one (including all stored procedures,etc.), but being a relative noob to SQL Server, I can't seem to figure out exactly how to accomplish this. Neither database holds anything that the other holds; data-wise, stored procedure-wise or any other wise. ;-)
Can anyone point me in the right direction?

View 1 Replies View Related

REPLICATION MERGING

Aug 20, 2002

Hi, I want to make fusion replication.

We've got an incident database on our server and we want our
consultants could add, modify, delete incidents on our customers sites
with their laptop.
When they come back we can also synchronise our incidents database
with their modifications.

I defined the database on our server ( sql7 sp3) as distibutor and
publisher, the other computers coulb be only suscribers.

It would be very easy except for a case :

when a line is modified on our server database and the same line in
the same table is modified on the suscriber computer, the changes on
publisher (distiributor) seems to have priority on the suscribers.
But we would like to control this : we want the suscribers, when they
come back, if this case appears, could choose good merging or not if
it's possible, and if it is not, we would like at less they could have
a message saying they will lost that they change (incident by incident
if it's possible)

So what is possible to resolve it by the best way ?

Thanks to your answers

Best regards

Axel

View 1 Replies View Related

Merging Fields

Sep 4, 2001

Help!!, Does anyone know of a way that I can merge three seperate fields into one field in my sql statement.
EG.
SELECT catnumber, catnumber2,catnumber3
FROM Categories
WHERE Customer = 'xxxx' and itemnumber = 1 or 2 or 4

I want the catnumber, catnumber2, catnumber3 all in one field so I can sort by it.
If anybody could help me it would be greatly appreciated.
Thanks
Mike

View 1 Replies View Related

Merging On Export

Apr 2, 2008

Hi,

I need to figure out what is the easiest way to do this is. I have two tables that have the following columns:


Code:

TABLE 1
AcctNbr, GiftRef, Gdate, PayCode, Amt

Table 2
GiftRef, Amt, MotvCode, FundId


I need to merge the two tables with GiftRef being the common table between them. I have exported the tables from MSSQL to Access and am wondering what the easiest way to do this is. Is there an SQL Query that can merge the two tables on export by GiftRef? Is it easier to do this in Access now that I've exported the two Tables? Any help on this would be awesome. Thanks.

View 5 Replies View Related

Importing And Merging Csv Using Sql

Sep 20, 2004

Hi Gurus.

My client drops for me many files like this on a shared drive M: daily
1_Test.csv
2_Test.csv
3_Test.csv

I would like you to advice on how to write a SQL code (that can include DTS if possible) that will take this files, merge them into one (since they have same columns) and send them to another client as one file. But it must only take the files of the same date and must not resend files i have send already. I need this to be an automated process since the files are dumped into M:drive midnite and I need this code so that I can schedule it as a job and run around 4h00am.

View 3 Replies View Related

Merging Databases

Aug 17, 2006

I'm pretty new to SQL altogether. I kinda gave myself a crash-course when the software I was using, Papertrack, was having problems. It all started when I tried to move the database. Now there are two separate databases that I can see on SQL Enterprise manager. I picked up the book and figured some things out, but still don't know how to merge the databases. I called the support for the software and got to know them on a middle-name basis. Is there a way I can merge the two databases so that the software can pull queries from both and access the files?
To anyone that likes a challenge,

Thanks

View 6 Replies View Related

Merging Two Mssql Db

Feb 5, 2004

I have a problem that I need help on.

Right now, I have two MSSQL server and I am trying to merge them into one.

The problem is, I do not know the login Id and password for some of the users.

I know the login information are stored under syslogins at the master db.

How do I get the information out and append to the syslogins table of the second mssql db?

Any help would be appreciated.

---alucarrd

View 3 Replies View Related

Merging Data

Jun 3, 2008

I have 2 tables that have the exact same structure and have some common values.
T1 = a,b,c,d,e
T2 = e,f,g,h

I want to create a single distinct table which captures all unique in both tables. I have a common fields ID in both, I can match on. I don't want duplicates which is what's happening now..

CombinedT = a,b,c,d,e,f,g,h

Thanks.

View 3 Replies View Related

Help Merging Records?

Oct 15, 2005

Hello there. I am Completely new to SQL and this forum, and this problem that I have may appear to be very basic to you guys but still... I was wondering if I could get some help with a database I am trying to make in MS Access.

I have used the Access TransferText function to import data from a text file into a table with an ID attached to each line, eg.

ID Text
1 Hello world
2 This is an example
3 Of my database

I want to merge the data, or copy it into a field in a new table to get:

ID Text
1 Hello World
This is an example
Of my database
2 [more imported text from a different table]

and i have been advised that SQL is the best way to do this. Is it possible to have line breaks in a field within microsoft access, or would it have to be structured as

ID Text
1 Hello World This is an Example Of My Database
2 ...

And how would i make the SQL to do this?

Thanks,

Thom

View 2 Replies View Related

Merging Data

Jan 12, 2007

I have a function that returns a range of numbers and a query that returns a varchar field and an int field. I would like to replace the int field in the query with unique ranged numbers from the function(one per row).

Any ideas?

Thanks,
Mark

-- use ifms

select *
from dbo.fnRange(5101,5152)


select --distinct s.OrgKeyId, 10420 TableNumber, 5100 DetailCodeNumber, s.NewStratalabel CodeDescription, s.NewStratalabel CodeAbbreviation, 1 CodeActiveFlag, Getdate(), 0
distinct s.NewStratalabel, 5100
from _StrataLabel_xref s
Left Outer Join(select * from org_Detail_Code where tablenumber = 10420 and orgkeyid in (Select distinct OrgkeyId from _StrataLabel_xref)) o
on o.OrgKeyId = s.OrgKeyId and o.CodeDescription = s.NewStratalabel
where o.Detailcodenumber is null
order by s.NewStratalabel


5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152

H3Bt5100
H3Cr5100
H4Bt5100
HS1Ar5100
HS1Cr5100
HS2Air5100
HS2Ar5100
HS2Br5100
HS2Cr5100
HS3Ai5100
HS3Bi5100
HS3Bit5100
HS3Cr5100
HS4Am5100
HS4Bi5100
HS4Bm5100
HS4Bt5100
HS4Ct5100
HS4Dr5100
NFrd5100
S2Ap5100
S2Ar5100
S2Ax5100
S2Bp5100
S2Br5100
S2Bw5100
S2Bx5100
S3Ap5100
S3Aw5100
S3Ax5100
S3Bw5100
S3Bx5100
SH1Api5100
SH1Br5100
SH1Cr5100
SH2Air5100
SH2Ap5100
SH2Ar5100
SH2Ax5100
SH2Bir5100
SH2Bix5100
SH2Bp5100
SH2Br5100
SH2Bw5100
SH3Ai5100
SH3Ap5100
SH3Api5100
SH3Bw5100
SH3Cr5100
SH3Di5100
SH4Bm5100
SH4Bwi5100

View 3 Replies View Related

Merging Two Database

Sep 10, 2007

Hi,
We have we had a database in 2006 with around 90 tables and later we created a new database in 2007 with more tables for same application. Now we want to have a database which will contain all records from the two above database. how should we go about this??

Bharath JrDBA

View 4 Replies View Related

Merging 3 Statements To 1

Apr 18, 2007

Hello,

I have a question. I want to perform the following task:

1) UPDATE wdoctyp SET ldoclock=0 WHERE docType='LEAVE'
2) SELECT idoclastsn FROM wdoctyp WHERE docType='LEAVE'
3) UPDATE wdoctyp SET ldoclock=1, idoclastsn=idoclastsn+1 WHERE
docType='LEAVE'

can I perform it in one SQL statement? Actually the reason I want to do this is because I want to prevent ldoclock from locking forever due to computer failure.

Can somebody give me a hand?

Best regards,
Tee Song Yann

View 3 Replies View Related

Merging Xml File

Apr 1, 2008

i have the following xml file :

<transport>
<train> 10
</train>
<plane>10
</plane>
<metro>10</metro>
<bm>10</bm>
<voiture><avion> 10 </avion></voiture> <voiture><train>10</train></voiture> <voiture><mercedesC230> 10 </mercedesC230></voiture>
<nissan>
<Z>10 </Z>
</nissan>
</transport>

**what i wanna do is to get the following result :

<transport>
<train> 10
</train>
<plane>10
</plane>
<metro>10</metro>
<bm>10</bm>
<voiture><avion> 10 </avion><train>10</train><mercedesC230> 10 </mercedesC230></voiture>
<nissan>
<Z>10 </Z>
</nissan>
</transport>
---------------------------------------------------------------------------------------------------------------------------------------------------------------
this means that i want to merge all the child nodes that belong to the same parent node.
thanks for any help

View 3 Replies View Related

Merging Tables

Feb 21, 2008

Hello Everybody,

I need some help and any input would be appreciated.

I am trying to merge 2 tables without using JOINS..

Is the only way to do this by creating a new table with all the columns from both tables or is there another way to do this?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved