LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting using SQL query

Yes, you've reminded me that Access changes its options depending on what kind of DB it's connected to.

I believe you need to go into the design view of the query and then click the down arrow which will appear on the leftmost button in the toolbar (it's probably Display or View or something like that) and there you should have the SQL view option. It's probably also accessible through the display menu (if there is one).


___________________
Try to take over the world!
Message 11 of 21
(2,297 Views)

Hello, tst,

Thanks for your patience and help. I am sure it has been tested by simple and maybe silly questions like mine above. Thanks for helping anyway:).

I got sql query it to work for my vi.

I wanted the indicator to reflect the whole data in ascending/descending order depending on column queried. But there is an issue.

Now my question is if I use fetch.vi and have my type as an array constant and my indicator as an array indicator why is my vi showing error. It makes no sense. Any insight.

By the way I am using Database Connectivity Toolset to get the fetch.vi feature.

Thanks in advance for any help.

0 Kudos
Message 12 of 21
(2,291 Views)

If you give no details and post the question twice you're really not making me want to help you.

The least you should do is post the code, explain what you're expecting to get and what error you're getting.


___________________
Try to take over the world!
Message 13 of 21
(2,279 Views)

Hello, tst,

Thanks for your patience and help.

I posted twice because I though the question was somewhat different. Sorry about the tediousness of it all.

I have posted a vi that shows my sorting my data. It works well and does what I want, but it does not show all the data when I sort. It gives only one answer instead of all the data in ascending/descending order.

Thanks for sticking around to answer my question.

By the way, the fetch.vi is from the Database Connectivity Toolset

0 Kudos
Message 14 of 21
(2,271 Views)
Even if I had the database connectivity toolkit (which I don't), the VI you attached doesn't help much since you don't provide the actual query and database. With both, someone with just Access could test the query itself. Have you run this query in Access and are the results the same or different? Before you write anything in LabVIEW, you should always test queries with the tools that the database provides. there may be a problem with the way you are using the toolkit but it's also very possible that there is a problem with the query.
Message 15 of 21
(2,264 Views)
Hello,
 
I have attached the Access database.
The table is jenny.
 
Query to sort:
Ascending sort for Timmy:
select timmy, tommy, theodore from timmy ASC
I also tried this syntax:
Ascending sort for Timmy:
select timmy*, tommy*, theodore* from timmy* ASC
 
I get an error.
 
Suggestions on how to get all the data for a column instead of just one when I sort by:
select timmy,tommy,theodore from timmy ASC
This works but gives me only one number instead of all the data.
 
Thanks for any suggestions.
0 Kudos
Message 16 of 21
(2,256 Views)

None of that syntax is correct. It doesn't appear you did what was recomended at all. The query called sqlquery in your database doesn't use this syntax. Did you just make something up? The query you have in your message doesn't return any data because you say "FROM timmy" and timmy is not a table, it's a column. Also, "select timmy*", etc. is incorrect syntax. If you want all columns, you do a "SELECT *". If you want specific columns, you do a "SELECT timmy, tommy". All that you really have to do is design the query in Access in Design View, test it, and then switch to SQL VIEW and copy the text from the SQL window into your LabVIEW program. If you had done that, you would have had this query:

SELECT jenny.timmy, jenny.tommy, jenny.theodore
FROM jenny
ORDER BY jenny.timmy, jenny.tommy, jenny.theodore;

If you want to explicitly add the ASC keyword after jenny.timmy AND jenny.tommy AND jenny.theodore, you can do that. The default is ASC.

Message 17 of 21
(2,247 Views)

Thanks for your patience and I apologize for the confusion.

My syntax for sorting works, I just wrote it wrong in the above post:

"select timmy, tommy, theodore from jenny order by timmy ASC"

The above syntax gives me the query I asked but it only returns only one answer.

I want it to return all the data points in that column timmy in ascending order.

0 Kudos
Message 18 of 21
(2,246 Views)
Since this query works in Access, then I can only conclude that you've got something wrong with the DCT functions and I can't run these since I don't have the toolkit. Something looks a little weird though. You've got a function called fetch binary data but the columns in the database are DBL. And what is the "0" constant that you have wired to the input of this function? I hope someone with the toolkit can post here with the correct answer. 
Message 19 of 21
(2,241 Views)


@Dennis Knutson wrote:
Since this query works in Access, then I can only conclude that you've got something wrong with the DCT functions and I can't run these since I don't have the toolkit. Something looks a little weird though. You've got a function called fetch binary data but the columns in the database are DBL. And what is the "0" constant that you have wired to the input of this function? I hope someone with the toolkit can post here with the correct answer. 



In fetch.vi, the "0" constant is the column index. There is also an input type definition that determines the variant of the indicator.

I hope someone with the toolkit can post a correct answer also.

But thanks for your time and hopefully an answer is coming.

Message Edited by roboticstudent on 03-10-2006 12:56 PM

0 Kudos
Message 20 of 21
(2,234 Views)