Showing posts with label request. Show all posts
Showing posts with label request. Show all posts

Tuesday, March 27, 2012

Combining subquery results into one field

Hello there

I have an application that allows users to book rooms in a building. I have a booking request table and a rooms booked table since there is a booking that can be made that includes multiple rooms. I have an instance where i need to select the booking requests for a particular date and need to display the rooms for each booking. Since the rooms booked table has the booking request id i'm wondering if there is a way to combine all the subquery results into one record to get around the error of having multiple records being returned in a sub query. The table structures are as follow:

bookingrequestion - bookingrequestid, startdate, enddate

roomsbooked-id, bookingrequestid, roomname

i'm basically trying to use the following query

select br.bookingrequestid, (select roomname from roomsbooked where id = br.bookingrequest) as rooms

i'd like the results of the subquery to return the room names as A,B,C. I'm trying to avoid having to obtain the recordset for the booking requests and then loop through them and for each one obtain a recordset for the rooms, seems like too many database hits to me.

thanks

I would look at returning two results to a dataset then creating a relationship between them. Displaying the results is pretty easy using nested repeaters:http://gridviewguy.com/ArticleDetails.aspx?articleID=185

Friday, February 10, 2012

Collation question

Hello!
I am building a Russian web site. Site request and response encoding is set
to windows-1251, data is displayed correctly. But in MS SQL Manager
evrything is messed up... like this ? ? ?
Database table field colaltion is set to: COLLATE Cyrillic_General_CI_AS
What I am doing wrong?
Thank you!
James
James
Did you define NVARCHAR(n) datatype for this column?
"James T." <gimenei@.hotmail.com> wrote in message
news:OLA2iyXUFHA.1148@.tk2msftngp13.phx.gbl...
> Hello!
> I am building a Russian web site. Site request and response encoding is
set
> to windows-1251, data is displayed correctly. But in MS SQL Manager
> evrything is messed up... like this ? ? ?
> Database table field colaltion is set to: COLLATE Cyrillic_General_CI_AS
> What I am doing wrong?
> Thank you!
> James
>

Collation question

Hello!
I am building a Russian web site. Site request and response encoding is set
to windows-1251, data is displayed correctly. But in MS SQL Manager
evrything is messed up... like this ? ' '
Database table field colaltion is set to: COLLATE Cyrillic_General_CI_AS
What I am doing wrong?
Thank you!
JamesJames
Did you define NVARCHAR(n) datatype for this column?
"James T." <gimenei@.hotmail.com> wrote in message
news:OLA2iyXUFHA.1148@.tk2msftngp13.phx.gbl...
> Hello!
> I am building a Russian web site. Site request and response encoding is
set
> to windows-1251, data is displayed correctly. But in MS SQL Manager
> evrything is messed up... like this ? ' '
> Database table field colaltion is set to: COLLATE Cyrillic_General_CI_AS
> What I am doing wrong?
> Thank you!
> James
>

Collation question

Hello!
I am building a Russian web site. Site request and response encoding is set
to windows-1251, data is displayed correctly. But in MS SQL Manager
evrything is messed up... like this ? ' '
Database table field colaltion is set to: COLLATE Cyrillic_General_CI_AS
What I am doing wrong?
Thank you!
JamesJames
Did you define NVARCHAR(n) datatype for this column?
"James T." <gimenei@.hotmail.com> wrote in message
news:OLA2iyXUFHA.1148@.tk2msftngp13.phx.gbl...
> Hello!
> I am building a Russian web site. Site request and response encoding is
set
> to windows-1251, data is displayed correctly. But in MS SQL Manager
> evrything is messed up... like this ? ' '
> Database table field colaltion is set to: COLLATE Cyrillic_General_CI_AS
> What I am doing wrong?
> Thank you!
> James
>