Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get data from 2 tables
Message
 
 
To
08/02/2019 08:42:02
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:
01666105
Views:
49
Can you please start from the beginning and explain the problem you're trying to solve? Show some samples of the data as well.

Why you're joining based on the hour? If that's the requirement, may be you need to store hour directly in addition to the date? Or have a computed column?

https://docs.microsoft.com/en-us/sql/relational-databases/indexes/indexes-on-computed-columns?view=sql-server-2017

Thanks

>>I didn't really read the original problem, so I don't know if proposed solution is good or not. I just commented that it's better to use T-SQL to create views and not SSMS designer which can not work with complex views.
>
>Yes thanks for helping
>
>I describe issue here in short.
>
>I am using these codes provided by Sir Christian Isberner
>
>
>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))
>
>
>I want to create view, the codes takes long time to display data.
>My question is: is it possible to modify above codes with JOIN clause?
>If yes then I guess the view will not take long time to display data.
>
>Regards
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform