LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting using SQL query

Hello,
 
Can someone write an sql query using fieldname and table to sort.
 
I am using the Database Connectivity Toolset and I believe I am able to query using sql but I am not sure about the syntax for sorting.
 
I looked it up, but I am coming up with an error when implementating it in my vi.
 
Thanks.
0 Kudos
Message 1 of 21
(4,251 Views)
The command for sorting is Order By. For example - Select field1, field2, field5 from T_Table, Order by field2.

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

Right from the Access help is:

SELECT fieldlist
    FROM table
    WHERE selectcriteria
    [ORDER BY field1 [ASC | DESC ][, field2 [ASC | DESC ]][, ...]]]

ASC is return the data in ascending order and DESC is descending order. If you are having a problem with a query, you should post the query that you are using. You can also design the query in Access, run it, and then display the SQL syntax.

Message 3 of 21
(4,221 Views)

Hello,

Thanks for all the insight.

This is my Access table:

Timmy
0 Kudos
Message 4 of 21
(4,205 Views)

Hello,

Thanks for all the insight.

This is my Access table:

Timmy 
0 Kudos
Message 5 of 21
(4,205 Views)

Hello,

Thanks for all the insight.

This is my Access table:

Timmy  
0 Kudos
Message 6 of 21
(4,210 Views)

Nothing was attached.

As Dennis said, you can design the query in Access and then change the view to the SQL view to see how the query should be written. If it works, you can copy and paste the text inside LV. If it doesn't, there is probably something wrong in the way you designed it.


___________________
Try to take over the world!
Message 7 of 21
(4,201 Views)
Sorry for the above repeat posts. I could not erase them so...
How do I go about finding the sql query in Access?
Thanks.
 
0 Kudos
Message 8 of 21
(4,197 Views)
Build a query in Access (there's a wizard and you can search the help for more details). Once it's built, right clicking on it in the queries list should give you an option to see it as in an SQL format.

___________________
Try to take over the world!
Message 9 of 21
(4,194 Views)

Thanks for helping. I appreciate your input and time.

I have attached what I have seen and it does not show the sql query although I have done as you suggested.

I have also pasted a little of the table: jenny and the fields that I am sorting in ascending and descending order by sql.

 

Message Edited by roboticstudent on 03-09-2006 10:05 AM

0 Kudos
Message 10 of 21
(4,192 Views)