Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get data from 2 tables
Message
From
08/02/2019 04:46:40
 
 
To
08/02/2019 04:28:22
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008 R2
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01666006
Message ID:
01666092
Views:
46
>>>>
>>>>SELECT Date, DatePart(hour,Date) as Hr, reading
>>>>FROM TABLE1 A
>>>>WHERE Date IN 
>>>>
>>>>(SELECT Min(Date) as date
>>>> FROM TABLE1 B
>>>> WHERE DatePart(hour,A.Date)= DatePart(hour,B.Date) 
>>>> 
>>>>UNION
>>>>
>>>> SELECT Min(Date)as date
>>>> FROM TABLE2 C
>>>> WHERE DatePart(hour,A.Date)= DatePart(hour,C.Date)) 
>>>>
>>>
>>>
>>>
>>>Thanks sir your codes work fine in sqlserver new query window
>>>But I want to create a view from these codes instead of using codes every time.
>>>I shall pickup required data from view.
>>>
>>>To do this I put your codes under view like shown in image but it is displaying an error messages
>>>
>>>I think there will be use JOIN clause but I am unable to do this.
>>>Please help me to create a view with your codes
>>>
>>>Thanks
>>
>>Try the following Statement, which error do you receive?
>>
>>CREATE VIEW Test
>>AS SELECT Date, DatePart(hour,Date) as Hr, reading
>>FROM TABLE1 A
>>WHERE Date IN
>>(SELECT Min(Date) as date
>>FROM TABLE1 B
>>WHERE DatePart(hour,A.Date) = DatePart(hour,B.Date)
>>UNION
>>SELECT Min(Date) as date
>>FROM TABLE2 C
>>WHERE DatePart(hour,A.Date) = DatePart(hour,C.Date))
>
>
>Sir view created but when I try to click on design then it display error message shown in attachment.

Interesting, could be the following case:

https://stackoverflow.com/questions/28226369/i-have-a-view-that-runs-fine-when-executed-but-when-i-try-to-open-it-in-design
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform