Home > Archive > MySQL ODBC Connector > December 2005 > basic questions: setting a variable and using a column name









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author basic questions: setting a variable and using a column name
Joseph Alotta

2005-12-26, 8:23 pm

greetings,

I know this is pretty basic stuff, but I couldn't find an answer in
google.

1. I want to set the @maxdate variable, but mysql complains. What am
I doing wrong?

2. The 3rd to the last line:

and (p.value - t.amount) < -1000

I wanted to say

diff < -1000

but mysql also complained.





Thank you,

Joe.



set @maxdate = select max(date) from positions where account =
"111200512343222";


select a.family, t.*, p.*, round(p.value - t.amount) as diff
from accounts as a,
transactions as t,
symbols as s,
positions as p
where a.account = p.account
and p.account = t.account
and p.symbol = t.symbol
and s.symbol = p.symbol
and p.date = @maxdate
and t.type = 'BUY'
and t.shares > 100
and t.amount > 3000
and s.type != 'MF'
and (p.value - t.amount) < -1000
order by diff
limit 20;



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com