I don't know whats happened sorry...I tried so hard to edit the previous post, and it would not let me, so I signed out , went to log in it said denied, asked for reset I think it has issues if you login with facebook as uses same email. please help
If you have problems with your account then you should use the Bugs and Suggestions[^] forum to get assistance from the administrators. I suggest you do so now from your original account, and delete this one.
I wish to only begin a select statement if the top value date is found. It's my way of knowing data has been added into a system at the beginning of the month e.g max date is 01/01/2018. If not take the last day of the month 31/10/2018. Table is called sales. Column is called SaleDateFrom.
I want to pull e.g data from SaleDateFrom <=01/01/2018...if not pull data
That does not make a lot of sense. If you ask for records whose date is less than or equal to 01/01/2018, then all records whose date is less than 31/12/2017 (I presume you mean 2017 here) will also fulfil the criteria.
I have 2 date time entries that represent time in and time out. I want to graph this data representing how many people or on the clock per 15 minute intervals.
Should I create a temp table that holds the qty of people that are clocked in for every 15 minute interval or what?
I usually use a view to service this type of requirement. Craft the view to supply only the required data eg date, starttime in 15 minute groupings and the number of people falling into the slots who are clocked on. End time only represents a person not clocked on and is irrelevant to the graph.
Never underestimate the power of human stupidity -
I'm old. I know stuff - JSOP
I was asked if there was merit to different logons for the website to the databases (via services) but couldn't find a suitable answer so thought I'd ask her as someone may know of a good practise or had experience.
Every day, thousands of innocent plants are killed by vegetarians.
I have a joins select statement, what I want is, if I am having same tables in two left joins and with exclusive Data then in another table when we are joining Data in ON clause I want to be able to Join one or the other table to get the Data, maybe like a case statement but joining one table in condition over the other.
Here is the example:
<pre>DECLARE @AdminAddressTypeId int
SET @AdminAddressTypeId = (select top 1 AddType.PKAddressTypeLKPId from AddressTypeLKP AddType where AddType.Description = 'Administrative')
-- ,OW.Description as OwnershipType
--,OW.Code +'-'+ OW.Description as OwnershipType
--,MGMT.Description as ManagementType
,PRG.Description as ProgramType
--,C.County_Name as CountyName
,C.PK_Geographic_Location_Code + '-' + C.County_Name as CountyName
--,LET.Description as LegalEntityType
FROM [dbo].[LegalEntity] LE
-- left outer join [dbo].[OwnershipTypeLKP] OW ON LE.FKOwnershipTypeLKPId = OW.PKOwnershipTypeLKPId
-- left outer join [dbo].[ManagementTypeLKP] MGMT ON LE.FKManagementTypeLKPId = MGMT.PKManagementTypeLKPId
inner join [dbo].[ProgramTypeLKP] PRG on LE.FKProgramTypeLKPId = PRG.PKProgramTypeLKPId and PRG.Description = 'Mental Health'
left outer Join [dbo].County C on LE.FKCountyLKPId = C.PKCountyId
--left outer join [dbo].[LegalEntityTypeLKP] LET on LE.FKLegalEntityTypeLKPId = LET.PKLegalEntityTypeLKPId
Left outer join LegalEntityAddress LEA_Admin on LE.PKLegalEntityId = LEA_Admin.FKLegalEntityId and LEA_Admin.FKAddressTypeLKPId = @AdminAddressTypeId and LEA_Admin.IsValid = 1 and ( LEA_Admin.EffectiveDateTo is null or LEA_Admin.EffectiveDateTo > getdate())
--(case when @AAEffectiveDateTo ='' then 0 else @AAEffectiveDateTo end)
left Outer JOIN Address AA ON LEA_Admin.FKAddressId = AA.PKAddressId
Left outer JOIN County Admin_CY on Admin_CY.PKCountyId = AA.FK_County
Left outer join State Admin_S on Admin_S.PKStateId = AA.FK_State
where LE.IsCompleted = 1
What I want is I am checking for only LegalEntityAddress that are Admins, but if Admin Address is not available for that Legal Entity I want to display any address that has the latest closing Date, if it doesn't find any data for these two conditions then I want any first date that's available or the one with highest PK value.
If I can achieve this by having one time join of the table that will be nice if I can't get it by using one same table join or need same table to be joined multiple times, please help me how can I achieve it. If I need to have LegalEntityAddress multiple joins with different conditions then how can I handle that situation in further down tables which are using this LegalEntityAddress reference table to join.
Any help would be very helpful, thanks in advance.
Last Visit: 21-Oct-19 7:19 Last Update: 21-Oct-19 7:19