Link to home
Start Free TrialLog in
Avatar of datafarmer
datafarmer

asked on

SQL Pivot or Query

SQL coding question.
Consider the following table: Itin

 ID      Restraunt      Date        Position
 ---  --------------    ------ ----------
  1       Mikes            2/1/14  Waiter-1
  2       Mikes            2/1/14  Waiter-2
  3       Mikes            2/1/14  Waiter-3
  4       John            2/1/14  FrontDesk
  5       John            2/1/14  Bartender
  6       John            2/2/14  Waiter-1
  7       John            2/2/14  Waiter-3
 15       Mikes            2/2/14  Waiter-3
  8       Mikes            2/2/14  Tables
  9       Mikes            2/3/14  Waiter-3
 10       Mikes            2/3/14  FrontDesk
 11       Mikes            2/4/14  Bartender
 12       Mikes            2/4/14  Waiter-1
 13       Mikes            2/4/14  Waiter-3

What I want to do, is show the above in a grid of at least three or four columns.
Like this:
Restraunt       Date        Positions
 --------------  ------ ---------
  John             2/1/14 Bartender      Frontdesk      
  John              2/2/14      Waiter-1      Waiter-3
  Mike             2/1/14      Waiter-1      Waiter-2      Waiter-3
  Mike             2/2/14 Waiter-3      FronDesk

Is there anyway to remotely do this via a SQL query?
ASKER CERTIFIED SOLUTION
Avatar of Ioannis Paraskevopoulos
Ioannis Paraskevopoulos
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your topic areas include both MS Access and SQL Server.

Which are you using?  The SQL Syntax and/or code will be quite different depending on which platform you are using.
Avatar of datafarmer
datafarmer

ASKER

The reason I said Access and SQL is because I have to code for both, if possible.  I understand the syntax would be different.
What is the exact setup?  Access Front-End/SQL Back-end?
The data is housed in two separate applications.  Desktop can use Access.  Web based is strictly MS SQL 2005.   We would like to be able to offer the same functionality (or view) to both sets of users.   The actual SQL query can be different.. as our software allows for that.
So I can have query that is used for Access an another that is used for SQL.
 
Access databases are 2003, and up.  Sql databases are 2005 and up.
Sorry, but i do not know about Access. About SQL, did you try my query posted earlier?
wanted Access as well.. but no other suggestions.... Thanks for SQL