G
Guest
Need some help with SQL view. I can't write sql queries and I have a
spreadsheet that is linked to our sql db. So what I do is design the queries
in access with linked tables then choose sql view and plunk it into the query
builder in excel to link the pivot table to the sql db. I've run into a
problem with an IsLike statement -- the query bulder won't let me put the
field 'apptnote' (see below) in and create the islike clause. I'm not sure
how it's supposed to be written. I've attached the sql code form access and
the one from the query builder. The query is supposed to return any records
where the 'apptnote' contains the word "implant" OR the 'appttype' is 6 OR
the 'apptype' is 16 (in all cases the pendingsource=0). Ignore the FROM
statement because the datasource is slighly different (linked table in first,
SQL db in second). Thanks for any help.
SQL View from Access for Query that works:
SELECT dbo_ApptPending.ApptPendingID, dbo_ApptPending.OfficeID,
dbo_ApptPending.ProviderID
FROM dbo_ApptPending
WHERE (((dbo_ApptPending.PendingSource)=0) AND
((dbo_ApptPending.ApptTypeID)=6 Or (dbo_ApptPending.ApptTypeID)=16)) OR
(((dbo_ApptPending.ApptNote) Like "*implant*"))
GROUP BY dbo_ApptPending.ApptPendingID, dbo_ApptPending.OfficeID,
dbo_ApptPending.ProviderID;
SQL View from Excel Query Builder that works except for ApptNote portion
SELECT ApptPending.CreateDate, ApptPending.ApptPendingID,
ApptPending.OfficeID, ApptPending.ProviderID
FROM DWare.dbo.ApptPending ApptPending
WHERE (ApptPending.PendingSource=0) AND (ApptPending.ApptTypeID=6) OR
(ApptPending.ApptTypeID=16)
GROUP BY ApptPending.CreateDate, ApptPending.ApptPendingID,
ApptPending.OfficeID, ApptPending.ProviderID
spreadsheet that is linked to our sql db. So what I do is design the queries
in access with linked tables then choose sql view and plunk it into the query
builder in excel to link the pivot table to the sql db. I've run into a
problem with an IsLike statement -- the query bulder won't let me put the
field 'apptnote' (see below) in and create the islike clause. I'm not sure
how it's supposed to be written. I've attached the sql code form access and
the one from the query builder. The query is supposed to return any records
where the 'apptnote' contains the word "implant" OR the 'appttype' is 6 OR
the 'apptype' is 16 (in all cases the pendingsource=0). Ignore the FROM
statement because the datasource is slighly different (linked table in first,
SQL db in second). Thanks for any help.
SQL View from Access for Query that works:
SELECT dbo_ApptPending.ApptPendingID, dbo_ApptPending.OfficeID,
dbo_ApptPending.ProviderID
FROM dbo_ApptPending
WHERE (((dbo_ApptPending.PendingSource)=0) AND
((dbo_ApptPending.ApptTypeID)=6 Or (dbo_ApptPending.ApptTypeID)=16)) OR
(((dbo_ApptPending.ApptNote) Like "*implant*"))
GROUP BY dbo_ApptPending.ApptPendingID, dbo_ApptPending.OfficeID,
dbo_ApptPending.ProviderID;
SQL View from Excel Query Builder that works except for ApptNote portion
SELECT ApptPending.CreateDate, ApptPending.ApptPendingID,
ApptPending.OfficeID, ApptPending.ProviderID
FROM DWare.dbo.ApptPending ApptPending
WHERE (ApptPending.PendingSource=0) AND (ApptPending.ApptTypeID=6) OR
(ApptPending.ApptTypeID=16)
GROUP BY ApptPending.CreateDate, ApptPending.ApptPendingID,
ApptPending.OfficeID, ApptPending.ProviderID