Re: SQL for Pivot Result



Arlyn_L (Arlyn_L@xxxxxxxxxxxxxxxx) writes:
I am attempting to use an oleDbDataAdaptor to access a database with three
tables:
temp_p with fields recno, ...
temp_ppv with fields recno, uid, type, ...
temp_pd with fields uid, value, ...
table temp_pv is a link table for a many to many relation with linked to
temp_p by recno and linked to temp_pd by uid.
table temp_pd.value contains place name elements whose function is defined
by the content of temp_ppv.type

I need to produce a pivot result to place in a Datatable.

I Have tried the following SQL with the result 'Function name is missing'.

I would suppose that message comes from the DB Engine you are acessing,
but you did not say which. The query looks like something that should
work on any engine, but you never know. Except for one thing: the backticks
around "value". They appear funny, at least for an SQL Server person like
me.

Maybe you should ask in a forum devoted to the RDBMS you are using.

--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Using SQL Server Native Client (ODBC) - SQLDriverConnect No re
    ... Server by using the SQL Server Native Client (ODBC). ... Reading Books Online, it seems that in ODBC, you should use UID, not ...
    (microsoft.public.sqlserver.connect)
  • Re: Login failed for user (null)...Reasons?
    ... >authentication (UID and password) fails from an Access application. ... >tried a ODBC DSN and a DSN-less connection. ... >I can get to the SQL Server with Enterprise Manager, ...
    (microsoft.public.sqlserver.odbc)
  • Re: Login failed for user (null)...Reasons?
    ... >authentication (UID and password) fails from an Access application. ... >tried a ODBC DSN and a DSN-less connection. ... >I can get to the SQL Server with Enterprise Manager, ...
    (microsoft.public.sqlserver.connect)
  • Login failed for user (null)...Reasons?
    ... A SQL Server I'm trying to connect to with SQL Server ... tried a ODBC DSN and a DSN-less connection. ... Why is the SQL Server receiving a null UID? ...
    (microsoft.public.sqlserver.connect)
  • Re: INSERT or UPDATE
    ... It depends on your DB, some of them support MERGE (Oracle for example), which call either insert or update. ... for SQL server you need to implement your SP, ... Team blog: http://devkids.blogspot.com/ ... p> I have the a table with 2 fields: uid, ...
    (microsoft.public.dotnet.framework.aspnet)