Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL SELECT problem
Message
 
 
To
16/09/2005 18:59:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP3
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01050520
Message ID:
01050524
Views:
9
Try
SELECT invoice.inv_date, invoice.job_no, invoice.inv_no, ;
		invoice.cust_no, jobs.csr_init, jobs.total_frames, ;
		customer.company, customer.firstname, customer.lastname, ;
	FROM invoice ;
	INNER JOIN customer on customer.cust_no = invoice.cust_no ;
	INNER JOIN jobs ON jobs.job_no = invoice.job_no ;
	WHERE invoice.inv_date BETWEEN from_date AND to_date ;
	ORDER BY jobs.csr_init, invoice.inv_date ;
	INTO CURSOR csr_detl
Notice that only one table is used in FROM clause because the rest are JOINed to it. I also remove GROUP BY clause because there're no aggregate functions used.


>I have not done any programming in over two years and I have to do a few tasks here. Can someone please tell me what is wrong with this statement:
>SELECT invoice.inv_date, invoice.job_no, invoice.inv_no, invoice.cust_no, 
jobs.csr_init, jobs.total_frames, customer.company, customer.firstname,
 customer.lastname, ;
>	WHERE invoice.inv_date >= from_date .and. invoice.inv_date <= to_date 
FROM invoice, jobs, customer ;
>	INNER JOIN customer on customer.cust_no = invoice.cust_no ;
>	INNER JOIN jobs ON jobs.job_no = invoice.job_no ;
>	GROUP BY jobs.csr_init ORDER BY jobs.csr_init, invoice.inv_date ;
>	INTO CURSOR csr_detl
>The invoice and jobs table have a 1:1 relationship, and customer has a 1:many relationship with jobs and invoices. I keep getting a blank table when I run the above statement. And I have checked there is plenty of data that should be selected. When I took out the INNER JOINs the selection was still going after 20 minutes so I canceled it (I am running a 3.2Ghz PC with 1Gb RAM).
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform