Combing Cloumns

Sep 7, 2006

HI
I am having one table.
in that columns are trid and remarks.
the data is:
trid   | remarks
----------------------
1     travel:comment1
1     travel:comment2
1    emp:emp comment1
1   emp:emp comment2
 
so i want to display query like in this below format:having 3 columns,i.e trid, travel remarks, empremarks  and travelremarks should display data start with 't' , empremarks data should display data starts with 'e'.
 
I am getting data start with 't'  and 'e',but how to combine travel data, emp data. and it should display in one row itself instead of 4 rows for every trid '1'.
trid    |                     travelremarks                                |                                             emp remarks
-----------------------------------------------------------------------------------------------------------------------------------------------
1                         travel:comment1,travel:comment2                                                     emp:emp comment1,emp:emp comment2
 
please help me.
 
Thanks,
swapprose.

View 19 Replies


ADVERTISEMENT

How To Combine Two Cloumns And Display As One Column In UI ? How To Write Query For This?

Mar 14, 2008

I have 2 Columns FirstName and LastName but i need to show it in UI as User Name ,that means i need to combine both First Name and Last name and display both as 1 field namely UserName ,How to query tht ? What shld i use?

View 2 Replies View Related

Combing 2 Queries Into 1

Nov 19, 2003

I have spent several hours hurting my brain tring to solve the following. I am hoping one of you SQL gurus can help me out.

I have two tables (each with two fields):

Group with GroupName and GroupDescription

Here is some sample data:

HR HumanResources
IT Information Technology
Boston BostonOffice
NJ NewJerseyOffice

GroupMember with GroupName and UserID

Here is some sample data:

IT CMessineo
NJ CMessineo
Boston JSmith
IT JSmith

What I want is a single stored procedure that when passed a UserID will return a result set that lists all the groups and a 1 or ) if the UserID is a member of that group.

For example calling the procedure and passing CMessineo would produce this result:

HR 0
IT 1
Boston 0
NJ 1

Can this be done in a stored procedure?

This is what I have so far, but I am in over my head:


(
@UserID varChar(40)
)
As
SELECT"GROUP".GROUPNAME, (SELECT ???
FROM"Group", GroupMember
Where"Group".GroupName = GroupMember.GroupName and GroupMember.UserID = @UserID)

FROM"GROUP"


Thanks in advance,

Chris

View 1 Replies View Related

Combing Tables From Multiselect

Feb 9, 2007

i have a form that has a checkbox list

a table called checkboxitems populates the checkboxlist (checkname, checkid) and when submitted the selected items are put into another table's column selecteditems like "1,5,9"

is there a way to do an inner join or something to get the checkname dependent on which which items are in the selectitems

View 1 Replies View Related

Combing Two Tables With No Relationship

May 8, 2007

Which way to go?
Have two separate programs(Visual Studio-Coded in Visual Basic) that share the same sql 2005 database(called Night Audit)
The tables are called RoomSettlement and Settlement.
They were separate tables and separate programs in the past because it was just exported in excel to a visual integrator that dumped the amounts into our accounting software.


Now needing to combine the two tables(that have no link) on to a single excel sheet daily where the tables have the same date:
Table: Room Settlement – Field: RoomSettlementDatetxt =
Table: Settlement – Field: SettlementDatetxt


Any Ideas on the best way to go? (Link the tables with a foreign key and primary key, maybe union based on date, or any easier suggestion with out having to change a lot of the program )



Room Settlement Table
PrimaryKey
Availabilitytxt
Ratetxt
Othertxt
Arrivalstxt
departurestxt
GuestCounttxt
HotelOccupancytxt
AverageDailyRatetxt
RevPahrtxt
HotelRevenuetxt
ownerrentaltxt
hoteltransienttxt
hotelcorptxt
hotelgovtxt
hotelpacktxt
hotelexpediatxt
hotelsynxistxt
hotelothertxt
rentalpooltxt
employeetxt
Hotelnightstxt
activitestxt
Bonustxt
Golftxt
Tvinternettxt
laundrytxt
misctxt
petstaytxt
Telephonetxt
Purchaseunittxt
Damageincometxt
resalerevtxt
latefeestxt
IntrestIncometxt
Taxestxt
RoomSettlementDatetxt
sitetxt
senddatetxt





Settlement Table:

PrimaryKeyintUn
PreviousGuesttxt
TransferCityLedgertxt
ActivityGuesttxt
transferfromadvdepositguesttxt
transfromguesttoguesttxt
GuestchagefromInctxt
Guestnetcashtxt
Guestcheckstxt
guestpaidout
guestlockboxtxt
guestaetxt
GuestDinerstxt
GuestDiscovertxt
GuestMastercardtxt
GuestVisatxt
guestdepositchangecashtxt
guestnetchangetxt
guestnewbalancetxt
guestsystembalancetxt
guestvariance
PreviousCity
ActivityCitytxt
Citynetcash
Citychecks
citypaidouttxt
citylockboxtxt
cityaetxt
CityDinerstxt
CityDiscovertxt
CityMastercardtxt
CityVisatxt
citydepositchangecashtxt
citynetchangetxt
citynewbalancetxt
citysystembalancetxt
cityvariance
Sitetxt
DateStamptxt
SettlementDatetxt



Thanks JK

View 1 Replies View Related

Combing Multiple Databases For Ad Hoc Reporting

Nov 8, 2006

Hey all. Sorry to ask such a basic question, but I am needing to combine data from about 3 different databases into 1 ad hoc report. I know that you can include multiple datasets, but I need this to act as 1 dataset so that the table data between all databases are related to one another.

I know very little about the potential of analysis services / integration services, so I don't know if they contain the answer to my problem.

Does anyone have a suggestion of how I should approach this problem (as always, speed is a bit of a consideration here as well).



Thanks!

View 6 Replies View Related

Combing Queries - Grouping By Date Ranges

Aug 2, 2004

Masters,
The below queries return the data that I seek, but I have no idea how to combine them into a single query.


SELECT SUM(TOTALSVCAMT) - SUM(TOTALPAYMENTAMT) - SUM(TOTALADJAMT) as [0 to 30]
FROM MDM2
WHERE DATEDIFF(day, SERVICEDATE, getdate()) between '0' and '30'

SELECT SUM(TOTALSVCAMT) - SUM(TOTALPAYMENTAMT) - SUM(TOTALADJAMT) as [31 to 60]
FROM MDM2
WHERE DATEDIFF(day, SERVICEDATE, getdate()) between '31' and '60'

SELECT SUM(TOTALSVCAMT) - SUM(TOTALPAYMENTAMT) - SUM(TOTALADJAMT) as [61 to 90]
FROM MDM2
WHERE DATEDIFF(day, SERVICEDATE, getdate()) between '61' and '90'

SELECT SUM(TOTALSVCAMT) - SUM(TOTALPAYMENTAMT) - SUM(TOTALADJAMT) as [90+]
FROM MDM2
WHERE DATEDIFF(day, SERVICEDATE, getdate()) > '90'


Any assistance that can be provided will be greatly appreciated.
Grasshopper

View 1 Replies View Related

Combing In A Cursor, A Select Statement With The WHERE Clause Stored In A Variable

Mar 28, 2000

Hi
I am ramesh here from go-events.com
I am using sql mail to send out emails to my mailing list


I have difficulty combining a select statement with a where clause stored in a variable inside a cursor

The users select the mail content and frequency of delivery and i deliver the mail

I use lots of queries and a stored procedure to retrieve thier preferences. In the end i use a cursor to send out mails to each of them.

Because my query is dynamic, the where clause of my select statement is stored in a variable. I have the following code
that does not work

For example

DECLARE overdue3 CURSOR
LOCAL FORWARD_ONLY
FOR SELECT DISTINCT Events.E_Name, Events.E_SDate, Events.E_City, Events.E_ID FROM Events, IndustryEvents + @sqlquery2
OPEN overdue3

I get an error message at the '+' sign
which says, cannot use empty object or column names, use a single
space if necessary

How do I combine the select statement with the where clause?

Help me...I need help urgently

View 1 Replies View Related







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