Hello All.
I am new to SQL ... trying to make a query work untimately in Perl (v5.10.0 built for MSWin32-x86-multi-thread) against MySQL hosted remotely (which currently I don't know the version for). I am currently trying with Quantum DB plugin for Eclipse to run the query.
I am trying to work with 2 tables ... something equivalent to the following example:
Table: Orders
- OrderId (unique integer)
- CustomerNumber (non-unique integer)
- State (string - I guess varchar is the right term)
Table: Customers
- CustomerNumber (integer; unfortunately this isn't unique and I don't have write permissions; so I can only modify my select query)
- CustomerName
I have stated only relevant table and field names.
My intent is to generate output of the form:
Orders.OrderId, Customers.Custo merName, Orders.State
for orders which are not in the "Negotiatin g" or "Delivered" state.
I picked up the "first" keyword from thread:
And tried something like this:
	But Quantum DB throws an error that the syntax isn't right near (Customers.Cust  omerName) on line 1.
Can someone please help me find my mistake ? A link to an existing article will also be fine.
Thanks in advance,
Parag Doke
					I am new to SQL ... trying to make a query work untimately in Perl (v5.10.0 built for MSWin32-x86-multi-thread) against MySQL hosted remotely (which currently I don't know the version for). I am currently trying with Quantum DB plugin for Eclipse to run the query.
I am trying to work with 2 tables ... something equivalent to the following example:
Table: Orders
- OrderId (unique integer)
- CustomerNumber (non-unique integer)
- State (string - I guess varchar is the right term)
Table: Customers
- CustomerNumber (integer; unfortunately this isn't unique and I don't have write permissions; so I can only modify my select query)
- CustomerName
I have stated only relevant table and field names.
My intent is to generate output of the form:
Orders.OrderId, Customers.Custo merName, Orders.State
for orders which are not in the "Negotiatin g" or "Delivered" state.
I picked up the "first" keyword from thread:
And tried something like this:
Code:
	select first(Customers.CustomerName) as MyCustName, Orders.OrderId, Orders.State from Orders, Customers where Orders.State!='Negotiating' and Orders.State!='Delivered' and Customers.CustomerNumber=Orders.CustomerNumber order by OrderId;
Can someone please help me find my mistake ? A link to an existing article will also be fine.
Thanks in advance,
Parag Doke
Comment