Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Need help to build a query. Expand / Collapse
Author
Message
Posted Wednesday, April 9, 2014 2:33 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, June 8, 2014 6:58 AM
Points: 28, Visits: 124

Dear All,

Need help to build query ,Data in the below format

Name Dept Punch Date Status
Robin Purchase 4/3/14 18:00 Out
Robin Purchase 4/3/14 17:57 In
Robin Purchase 4/3/14 15:04 Out
Robin Purchase 4/3/14 14:20 In
Alex Accounts 4/3/14 14:09 Out
Alex Accounts 4/3/14 14:07 In
Alex Accounts 4/3/14 10:53 Out
Alex Accounts 4/3/14 7:52 In

I need the query which gives the output in the below Format
Name Dept Punch Date Status
Robin Purchase 4/3/14 18:00 Out
4/3/14 17:57 In
4/3/14 15:04 Out
4/3/14 14:20 In
Alex Accounts 4/3/14 14:09 Out
4/3/14 14:07 In
4/3/14 10:53 Out
4/3/14 7:52 In

Thanks and Regards
Prakash
Post #1559827
Posted Wednesday, April 9, 2014 3:41 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
You cannot just have less columns on a row then on another row.
Formatting output is better done with a front-end application, like SSRS.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1559846
Posted Thursday, April 10, 2014 4:49 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 9:18 AM
Points: 1,013, Visits: 2,110
Keon is right, sounds like you just want a simple SSRS report grouped by Name.
Post #1560348
Posted Thursday, April 10, 2014 4:51 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 9:18 AM
Points: 1,013, Visits: 2,110
Dang, sorry spelled "Koen" wrong.
Post #1560349
Posted Thursday, April 10, 2014 5:10 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
Michael_Garrison (4/10/2014)
Dang, sorry spelled "Koen" wrong.


No problem.

There is an "edit" button by the way.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1560361
Posted Thursday, June 5, 2014 9:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 25, 2014 11:17 PM
Points: 1, Visits: 20
select name,dept, punchdate ,status from Table_name
where name='robin'

select name,dept, punchdate ,status from Table_name
where name='Alex'
Post #1578128
Posted Thursday, June 5, 2014 11:59 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
manju00005 (6/5/2014)
select name,dept, punchdate ,status from Table_name
where name='robin'

select name,dept, punchdate ,status from Table_name
where name='Alex'


The original question was about formatting, not about how to select the data.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1578148
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse