Showing posts with label guest. Show all posts
Showing posts with label guest. Show all posts

Friday, March 30, 2012

question about selecting records

I have a mssql database like this:

Table1:
ID GuestName Agent CheckInDate OtherColumn
1 Guest 1 Peter 1/11/2005 whatever
2 Guest 2 Peter 1/11/2005 whatever
3 Guest 3 John 1/11/2005 whatever
4 Guest 4 John 1/13/2005 whatever
5 Guest 5 Peter 1/11/2005 whatever

I want to display it group by same Agent and CheckInDate. Like this:

Agent CheckInDate Records
Peter 1/11/2005 3
John 1/11/2005 1
John 1/13/2005 1

How can I do this? Please help, thank you.

select agent,checkindate,count(agent) Records
from <table>
group by agent,checkindate
|||Thank you. And there's another question. The CheckInDate values has time value in it. for example, 1/11/2005 1:15:45PM. If I use GROUP BY CheckInDate, the time value matters. How can ingore time value and just GROUP BY date value?|||cast or convert it to a varchar|||CONVERT(VARCHAR(12), myDateColumn, 101)

Tuesday, March 20, 2012

question about guest account in model database...

i disabled most guest accounts in sql server soon as i set it up.
excepts the ones in master and temp dbs. but the guest accout in model
database says 'via group permission' and i couldn't delete it. should i
just leave it or do something about it? (if so, how). thank youI no group has got acces permissions to the database, you can leave it.
JN.
"=== Steve L ===" <steve.lin@.powells.com> a crit dans le message de news:
1111793365.858280.322730@.f14g2000cwb.googlegroups.com...
>i disabled most guest accounts in sql server soon as i set it up.
> excepts the ones in master and temp dbs. but the guest accout in model
> database says 'via group permission' and i couldn't delete it. should i
> just leave it or do something about it? (if so, how). thank you
>