2
$\begingroup$

Given the following connection to an SQL query works but the data comes out wrong:

data = Table[SQLSelect[conn, "All", {"col1", "col2"}, 
   SQLColumn["col1"] == n && SQLColumn["col2"] ==  o], {n, 1, 8}, {o, 21,
    30}];

If I do not use the 'Table' function, I get the expected results by inserting the actual numbers after == when running the query. I need to create a 54 x 289 table from my data and obviously for this large data set this will be impractical to key in and export piece by piece.

Any suggestions?

$\endgroup$
  • 2
    $\begingroup$ Try this data = SQLSelect[conn, "All", {"col1", "col2"}, SQLMemberQ[Range@8, SQLColumn["col1"]] && SQLMemberQ[Range[21, 30], SQLColumn["col2"]]]; $\endgroup$ – Dr. belisarius Mar 20 '14 at 5:22
  • $\begingroup$ I can't test it, will post as an answer if it works $\endgroup$ – Dr. belisarius Mar 20 '14 at 14:15
  • $\begingroup$ Much better! I had to increase the Java heap size for jDBC (I went from 3GB to 4GB). It executed many many times faster . I think I still have a logic problem telling the query which rows to select but this is a step in the right direction! Thanks! $\endgroup$ – Sinistar Mar 20 '14 at 14:49
  • $\begingroup$ When you come to solve it, post it as an answer and ping me to upvote $\endgroup$ – Dr. belisarius Mar 20 '14 at 15:40
  • $\begingroup$ I think we can offer your post as an answer. It does do what I asked. I just need to refine my question for the results I was desiring. I upvoted your suggestion. Where did that confounded mark as answer button go? $\endgroup$ – Sinistar Mar 20 '14 at 17:18
1
$\begingroup$

Try this

data = SQLSelect[conn, "All", {"col1", "col2"}, 
                 SQLMemberQ[Range@8, SQLColumn["col1"]] && 
                 SQLMemberQ[Range[21, 30], SQLColumn["col2"]]];
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.