Hello everyone

I've been trying to google this and had no luck with this issue

So i have this form where it prints a certain record i search, but im trying to do restaurant form and a print form that it will print the last order done.

So I Know how to print it via search in a crystal report form, but i'm changing the view and i want it to print the last order saved.

So basically what i need is an SQL Query that will move to the last record created.

Hope i made myself clear what i need

Thanks in advance

Use order by desc clause.

SELECT * FROM TABLENAME ORDER BY OrderTakenDateTime DESC

Use order by desc clause.

SELECT * FROM TABLENAME ORDER BY OrderTakenDateTime DESC

Ok so let me try that and see what it does

Thanks

If you only want the last record, you may like to add TOP(1) to that however if you are working in a multi-user environment then you may not get the record you wrote.

It may be better to have a "OrderPrinted" column to record whether an order has been printed or not.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.