• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with SQL Query

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please if somebody can help me with a query.
I've the following tables



I want a query to get the the following data if the menu item links to an internal page:
id | title | published | menu_id | page_id |

and the following data if the menu item links to an url:
id | title | published | menu_id | url_id | url


Thanks,

Abu
[ January 31, 2007: Message edited by: Azz Romaysa ]
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Abu,
What do you have so far? Post that along with what you are stuck on and we can help you more.
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey azz, I agree with what Jeanne says you need to show some work man !!! By the looks of it you may want to check out the Table Join concept. chill
 
Azz Romaysa
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

This is what I've so far


It always returns an empty table.

What I want is the following result when menu_item_id = 30:


Or this one when menu_item_id = 25:


What is the query that I should have?
P.S. The menu_item cannot have an url_id and a page_id

Regards,
Azz
[ February 01, 2007: Message edited by: Azz Romaysa ]
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Azz,
Your query is good first step. It sets up the join structure.

There is a concept called an outer join. The syntax varies by database. You can find the syntax by looking at your documentation or googling your database and "outer join". The concept is the same across databases.
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope this helps... I havent tested it...



Thanks and Regards,
Arul.
 
Arulanand Dayalan
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More Simpler one...

 
Azz Romaysa
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you guys,

This is the query that worked for me:


Arulanand: your last query returned always an empty row.

My problem now is how can I update all these tables once. Could somebody help me?

Kind Regards,

Azz
[ February 06, 2007: Message edited by: Azz Romaysa ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic