Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A way to comibine two SQL calls.

Status
Not open for further replies.

kpdvx

Programmer
Dec 1, 2001
87
US
Here are two seperate MySQL calls, can I possibly consolidate these into one?

// perform SQL query. Get the max for the issue_id, this so we know what numbers we can work with.
$query1=MYSQL_QUERY(&quot;SELECT max(issue_id) as max_id FROM comic_issues WHERE display_date <= curdate()&quot;);
$getvar=MYSQL_FETCH_ARRAY($query1);
$max_issue_id=$getvar[&quot;max_id&quot;];

// perform SQL query. Look up the max_issue_id we just got, and grab all of its info.
$query = &quot;SELECT issue_id, type, title, display_date, image_filename
FROM comic_issues
WHERE issue_id = $max_issue_id&quot;;
$result = mysql_query($query);
 
select issue_id,type from comic_issues where issue_id in(SELECT max(issue_id) as max_id FROM comic_issues WHERE display_date <= curdate())


check if this works.

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top