Concluído

Wordpress; updated SQL query code for a very small function

I need a custom Wordpress function that will return an array of oldest values from the database.

For this example; I have created a bunch of custom posts ('machine') in Wordpress. Each custom post has been assigned two custom metadata keys; 'last_updated_timestamp' and 'serial_number'. Timestamps are in epoch format (i.e. '1557240847').

This is the code that I have so far, and it returns an array of serial numbers as expected. Although, I need the SQL query updated, as to instead return the OLDEST serial numbers found in the database, based on their metadata keys 'last_updated_timestamp'.

function get_oldest_serial_numbers($limit = 10) {

global $wpdb;

$result = $wpdb->get_col( $wpdb->prepare("

SELECT pm.meta_value FROM {$wpdb->postmeta} pm

LEFT JOIN {$wpdb->posts} p ON [login to view URL] = pm.post_id

WHERE pm.meta_key = 'serial_number'

AND p.post_status = 'publish'

AND p.post_type = 'machine'

LIMIT %d

",$limit));

return $result;

}

Habilidades: MySQL, PHP, SQL, WordPress

Veja mais: wordpress functions cheat sheet, wordpress functions.php example, wordpress custom sql query, wordpress functions tutorial, wordpress functions pdf, wordpress sanitize html, wordpress custom functions, how to fetch data from database in wordpress page, sql query tree structure records, asterisk call forward database sql query, wordpress code sort function, wordpress sql query posts category, wordpress custom sql query terms, sql query wordpress custom fields, wordpress custom sql query posts, writing sql query wordpress, wordpress code search function, small sql query, wordpress custom sql query categories, wordpress code call function

Acerca do Empregador:
( 6 comentários ) Helsingborg, Sweden

ID do Projeto: #19468540

Concedido a:

TakeReal

Hello, My name is Sergey. I am Freelancer from Saint Petersburg, Russia. I can help you as an experienced WordPress programmer to update your code/SQL to return the OLDEST serial numbers found in the database, based o Mais

$30 USD em 1 dia
(1829 Comentários)
8.1

21 freelancers estão ofertando em média $27 para esse trabalho

mascotindia123

Hello there Myself having has 10 + years experience of web site development. Expert in Custom programming in php / Mysql / Jquery /Laravel/ Code Igniter/ Prestashop/ Drupal/ Wordpress/ Joomla / OSC / Magento /OpenCart Mais

$35 USD em 1 dia
(253 Comentários)
7.5
lightingdavid

Hello. I 'm expert in "PHP, SQL, WordPress, MySQL" and I have working for 7+ years in this field. I 'm very interest to your project. I have checked your project description carefully and i can do it. I 'll do my best Mais

$30 USD em 1 dia
(102 Comentários)
6.0
NadirBouchama

Hello there! how are you doing? if the project is fairly paid I can build you a small part of it as form of a demo, afterwards you'll decide if you should hire me or not so don't hesitate to contact me even though you Mais

$30 USD em 1 dia
(55 Comentários)
5.9
webcast

Hello sir, I am good at : 1. WordPress, Shopify, Magento, Opencart, Joomla web development 2. PSD to HTML 3. Responsive web development 4. Graphics Designing 5. Photoshop 6. PHP 7. html + CSS Styling 8. js & jQuery. Mais

$30 USD em 1 dia
(100 Comentários)
5.5
aadips

Hi sir, i understand you need to update SQL query code for your project. i am sharing my few projects with you, please go through... 1. [login to view URL] 2. [login to view URL] 3. [login to view URL] 4. htt Mais

$15 USD em 1 dia
(56 Comentários)
5.3
gunslinger

Hi! I am an expert of PHP programming can work to update your SQL query in your wordpress. please kindly contact me for more further discussion, thank you.

$30 USD em 1 dia
(35 Comentários)
4.9
dchaidaris

Hello I can update the query that you have to return the oldest serial numbers first based on their metadata keys 'last_updated_timestamp'. You can always contact me if you have any questions. Thanks.

$30 USD em 1 dia
(33 Comentários)
4.8
erashrafkamal

Hello, Thanks for job posting. I have read the description carefully and give you 100% assistance as Wordpress Developer updated SQL query code for a very small function Skills- PHP, WordPress, Woocommerce, genesis, Mais

$35 USD in 2 dias
(16 Comentários)
4.2
Maneesh9746

As I understood, you need the records in descending order of the last_updated_timestamp I think it may be a quick tweak on that query by adding order by in it. Let's discuss more if both of us are in same track

$10 USD em 1 dia
(22 Comentários)
3.9
toongweb18

Good understanding in languages including PHP, MySql, SQL SERVER 2012 , Sql WorkBench, Laravel, CodeIgniter, WordPress, WordPress Themes, WordPress Plugins, HTML5, CSS3, Javascript, Jquery, Json, E-Commerce, Woo- Com Mais

$20 USD em 1 dia
(8 Comentários)
2.8
usmanahsan901

Dear Client, Hope You are fine, As a professional web developer I have build so many website and i have read your requirement and I can do this task We will discuss task in detail in Chat Skills: PHP, MVC (Codeigni Mais

$30 USD em 1 dia
(4 Comentários)
2.9
IjazSe

Hi there, Hope you are doing great!. I am expert and can surely assist you with my service in updating the query right now via ANY DESK. Looking forward for your positive response. Best Regards, Ijaz Hussa Mais

$30 USD em 1 dia
(4 Comentários)
2.6
WhiteHorse2019

Hello It's a piece of cake. i have experienced to work with client from [login to view URL] can find it in my portfolio I can help you to do it perfectly If you hire me, i can start right now and i will do my best for us th Mais

$30 USD em 1 dia
(3 Comentários)
2.6
ewr4fd4r3435re

Hi, very interesting and not hard job for me. I have fully understood your requirement. This is an agile programmer with more than 7 years experience. I graduated of BScH Computer Science who possesses an interesting a Mais

$25 USD em 1 dia
(6 Comentários)
2.6
sayanbiswas5

I understand your requirement and I assure that I'm the perfect choice for this task. I can complete this project in 1 hour and I am looking forward to discussing it. Please send me a message for discussion. I am 8+ Mais

$30 USD em 1 dia
(2 Comentários)
1.6
Shumit9217

Hello, sir. Much interested in your project, and I'd read all of your requirements carefully. I'm thinking this is the suitable one you're looking for. I'd like to talk with you over chat, share more details of your re Mais

$30 USD em 1 dia
(1 Comentário)
1.8
Rjnj

Hudson Agile Technologies LLC – A New Jersey Firm. Entity ID – 0450219485 We are head quartered in 30 Knightsbridge Rd Suite 525, Piscataway Township, NJ 0885 We are a Software Technology Outsourcing consulting Mais

$25 USD em 1 dia
(0 Comentários)
0.0
deepsinghrajawat

Dear Client, I have around 4+ years of experience in web development & designing field. I have experienced to solve various tasks/issues. My main concern is provide better solution to you so that I will nice feedba Mais

$25 USD em 1 dia
(0 Comentários)
0.0
ksmks0921

Hello. I can help you. I have enough experience and high skill in Wordpress, PHP , SQL. You will be satisfied with my work. Thank you.

$20 USD in 7 dias
(0 Comentários)
0.0
webdevche1

Hello there, I'm a fullstack developer with over 8 years experience of web development. Could we discuss more details? Sincerely. Jin.

$20 USD in 7 dias
(0 Comentários)
0.0