Wizard
Wizard

Reputation: 11285

select random row from MS access table

i want display 1 record from colums zodys, I'm programint in C#

I have table test and I want select row zodys

SELECT top 1 zodys from test ORDER BY rnd(zodys)

I get error: Data type mismatch in criteria expression.

Upvotes: 1

Views: 1073

Answers (2)

Joachim Isaksson
Joachim Isaksson

Reputation: 180987

Sadly being without the ability to test, but Rnd in Access queries takes a numeric parameter, so I presume zodys is not numeric.

Here's an entire article on the subject of random sorting in Access.

Upvotes: 1

HansUp
HansUp

Reputation: 97131

What is the data type of [zodys]? If it's text, that is why you're getting "Data type mismatch in criteria expression."

If you get that error message with [zodys] as a numeric data type, look at Rnd Function from Microsoft Office documentation for an explanation.

Upvotes: 1

Related Questions